Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
34231: sql: use time-based sampling for logical plans r=knz a=celiala Previously, the rate at which we sampled logical plans was once every 1000th time that fingerprint was executed. This diff changes the sampling rate from count-based (once every 1000th execution) to a time-based cluster setting (the default is set to once every 5 minutes). This solves the following: - For fingerprints with high execution counts, this prevent us from sampling too often and creating unnecessary overhead. - For fingerprints with lower execution counts, this allows us to refresh plans more frequently, which could be helpful if a user wants to verify that a configuration change has improved a fingerprint's logical plan and execution time. - Because stats are stored per node, having a timestamp additionally means that the UI can now determine and surface the plan that's the most recent across all nodes. - This also solves an edge case where statementStatistics might exist without a sample, which can happen if user has set `sql.metrics.statement_details.plan_collection.enabled` to false, or if the stats were collected before this feature was introduced. Release note: None Co-authored-by: Celia La <celia@cockroachlabs.com>
- Loading branch information