Skip to content

Instantly share code, notes, and snippets.

@bobvawter
Last active November 10, 2021 21:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobvawter/888ddd5ea3b6a57bb4a30490239c768d to your computer and use it in GitHub Desktop.
Save bobvawter/888ddd5ea3b6a57bb4a30490239c768d to your computer and use it in GitHub Desktop.
Summarize contention events in CockroachDB
WITH c AS (
SELECT DISTINCT ON (table_id, index_id)
table_id,
index_id,
num_contention_events AS events,
cumulative_contention_time AS times
FROM crdb_internal.cluster_contention_events
)
SELECT i.descriptor_name, i.index_name, c.events, c.times
FROM crdb_internal.table_indexes AS i
JOIN c ON i.descriptor_id = c.table_id AND i.index_id = c.index_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment