Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
139735: cli: improve debug zip transaction_contention_events query r=kyle-a-wong a=kyle-a-wong Previously, this query often timed out with errors like "memory budget exceeded" and "query execution canceled due to statement timeout." This was happening because the query needed to deduplicate all the rows returned after performing two left joins on system.statement_statistics. This table is denormalized, meaning many rows are returned for every row joined. To improve this query, CTEs are used to first create distinct (statement_fingerprint, query) and (transaction_fingerprint, queries) tables. Then, transaction_contention_events is joined onto those tables. This reduces the amount of deduplication required, improving performance. Fixes: CRDB-45216 Epic: none Release note (cli change): Improves the performance of the debug zip query that collects transaction_contention_events data, reducing the chances of "memory budget exceeded" or "query execution canceled due to statement timeout" errors. Co-authored-by: Kyle Wong <[email protected]>
- Loading branch information