cockroachdb / cockroachdb/cockroach

sqlstats: disable collecting statement stats by transaction fingerprint id

Open
#125,271 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-observability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
This is part of alleviated data cardinality for sql stats.
The number of statement statistics can blow up on transaction fingerprint id cardinality. Statement statistics can blow up when we run sets of statements in various different transactions, as we produce 1 row per distinct statement and transaction fingerprint id combination.

**Describe the solution you'd like**
In certain clusters we've seen cardinality go down drastically with this turned off. Currently we have a cluster setting to disable the transaction fingerprint id field of statement stats via the cluster setting [sql.stats.associate_stmt_with_txn_fingerprint.enabled](https://github.com/cockroachdb/cockroach/blob/e9a6d3d7c935dd347a4254729edf2db8c764dcbf/pkg/sql/sqlstats/sslocal/cluster_settings.go#L21).

**We should consider having 'false' as the default value here and not collect statement stats by txn fingerprint id.**

### Impact of Disabling
Today, the impact of setting the above cluster setting to false significantly impacts the transactions page experience:
- Breaks transaction query - this will now be blank. Today we construct this using the statements associated with the transaction (looking up the statement by the transaction_fingerprint_id). Instead we'll have to do the look up via each statement_fingerprint_id listed from the transaction.
- No statement stats in the transaction details page on the DB console (i.e. the table section displaying statements in the transaction details page - see image). Potential fix - Instead of showing no associated statements, we can simply list the stats for the statement fingerprints in the transaction on a global level in the time range.

### Opt-in
We can then investigate an opt-in approach per transaction fingerprint id, where users may be able to flag via db console certain transaction fingerprints for which they've identified a need to collect more granular stats for.

**Additional context**

Transaction details page statement stats
image

Jira issue: CRDB-39358

Epic CRDB-39776

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.