Closed Azhng closed 1 year ago
Thanks for taking a look at this issue @gtr. Though the code and the features have changed quite significantly since the issue has been filed.
The key changes here is that the statement fingerprint ID no longer uniquely identify a statements stats. This is because of the introduction of plan_hash
and transaction_fingerprint_id
.
statement fingerprint ID
can contain multiple different plan variations, represented by different plan_hash
. statement fingerprint ID
can be executed by multiple different transactions, represented by different transaction_fingerprint_id
This means that, a tuple of (statement fingerprint ID, plan_hash, transaction_fingerprint_id)
now uniquely identifies a single statements stats in the ssmemstorage.Container
.
The intention of this issue is really to get rid of sampledPlanKey
in the map. Since a sampledPlanKey
is one-to-one mapped to a statement fingerprint ID.
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!
Currently, in-memory statement statistics is keyed by a struct. The ordering is currently defined via anonymized query field in that struct. This introduce additional overhead for storage, IO and sorting comparison.
Since we are already computing the statement fingerprint id, for each of the
stmtKey
and we should use this fingerprint id for the dictionary key. Custom sorting behaviour can be delegated to SQL engine since the stats are also exported in a virtual table.Jira issue: CRDB-9417