Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql, sqlstats: remove logical plan sampling cluster settings #138042

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xinhaoz
Copy link
Member

@xinhaoz xinhaoz commented Dec 27, 2024

We've disabled logical plan sampling via the cluster setting
sql.metrics.statement_details.plan_collection.enabled since 22.2
since we've been able to collect and deserialize plan gists. We
have not heard any issues surrounding disabling this by default so
this commit removes logical plan sampling from sql stats entirely.

Details:

  • removes sql.metrics.statement_details.plan_collection.enabled
    which has been false since 22.2.
  • removes sql.metrics.statement_details.plan_collection.period which
    controlled the time in between samples
  • removes the savePlanForStats field from instrumentationHelper which
    was a flag used to indicate we should save the logical plan for sql stats

Epic: CRDB-45771

Release note (ops change): The following cluster settings have been
deprecated:

  • sql.metrics.statement_details.plan_collection.enabled
  • sql.metrics.statement_details.plan_collection.period

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@xinhaoz xinhaoz force-pushed the remove-logic-plan-sampling branch from 721d13b to cc771fc Compare December 27, 2024 20:58
For SQL stats we trace every new fingerprint in an application
container in order to populate statistics that are only available
via tracing for each fingerprint. This sampling logic worked by
tracking the SQL fingerprint strings encountered by each application
but did not factor in fingerprints that are not tracked by SQL stats,
such as TCL statements (BEGIN, COMMIT, ROLLBACK), were being treated
as new fingerprints on each execution which resulted in tracing being
turned on. This commit ensures that we don't consider TCL statements
in this sampling strategy. TestSampledStatsCollectionOnNewFingerprint
is also fixed as it was previously assuming that previously seen
statements in new transactions would trigger this sampling behaviour
when it should not - this was being erronneously triggered by
`BEGIN`.

```
name                                   old time/op    new time/op    delta
Sysbench/SQL/3node/oltp_read_write-10    5.61ms ± 3%    5.69ms ± 4%    ~     (p=0.167 n=8+9)

name                                   old alloc/op   new alloc/op   delta
Sysbench/SQL/3node/oltp_read_write-10    2.15MB ± 2%    2.12MB ± 2%  -1.24%  (p=0.029 n=10+10)

name                                   old allocs/op  new allocs/op  delta
Sysbench/SQL/3node/oltp_read_write-10     10.7k ± 1%     10.5k ± 0%  -1.69%  (p=0.000 n=10+9)
```

Epic: none
Part of: cockroachdb#133307

Release note: None
We've disabled logical plan sampling via the cluster setting
`sql.metrics.statement_details.plan_collection.enabled` since 22.2
since we've been able to collect and deserialize plan gists. We
have not heard any issues surrounding disabling this by default so
this commit removes logical plan sampling from sql stats entirely.

Details:
- removes `sql.metrics.statement_details.plan_collection.enabled`
which has been false since 22.2.
- removes `sql.metrics.statement_details.plan_collection.period` which
controlled the time in between samples
- removes the `savePlanForStats` field from instrumentationHelper which
was a flag used to indicate we should save the logical plan for sql stats

Epic: CRDB-45771

Release note (ops change): The following cluster settings have been
deprecated:
- `sql.metrics.statement_details.plan_collection.enabled`
- `sql.metrics.statement_details.plan_collection.period`
@xinhaoz xinhaoz force-pushed the remove-logic-plan-sampling branch from cc771fc to 388c5b4 Compare December 30, 2024 16:30
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by comment: the settings should be added to the retiredSettings map:

var retiredSettings = map[InternalKey]struct{}{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants