[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-cockroachdb-triaging-live-sql-activity":3,"mdc-ryj2cq-key":39,"related-repo-cockroachdb-triaging-live-sql-activity":2676,"related-org-cockroachdb-triaging-live-sql-activity":2770},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":34,"sourceUrl":37,"mdContent":38},"triaging-live-sql-activity","diagnose CockroachDB cluster performance issues","Diagnoses live CockroachDB cluster performance issues by identifying long-running queries, busy sessions, and active transactions using SQL-only interfaces. Use when users report cluster slowness, high CPU, or need to find runaway queries and their source applications without DB Console access.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"cockroachdb","CockroachDB","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fcockroachdb.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Database","database",{"name":20,"slug":21,"type":15},"SQL","sql",{"name":23,"slug":24,"type":15},"Debugging","debugging",3,"https:\u002F\u002Fgithub.com\u002Fcockroachdb\u002Fclaude-plugin","2026-07-12T07:57:17.446728",null,2,[31,32,8,33],"claude","cockroach-cloud","developer-tools",{"repoUrl":26,"stars":25,"forks":29,"topics":35,"description":36},[31,32,8,33],"CockroachDB development plugin for Claude","https:\u002F\u002Fgithub.com\u002Fcockroachdb\u002Fclaude-plugin\u002Ftree\u002FHEAD\u002Fskills\u002Fcockroachdb-observability-and-diagnostics\u002Ftriaging-live-sql-activity","---\nname: triaging-live-sql-activity\ndescription: Diagnoses live CockroachDB cluster performance issues by identifying long-running queries, busy sessions, and active transactions using SQL-only interfaces. Use when users report cluster slowness, high CPU, or need to find runaway queries and their source applications without DB Console access.\ncompatibility: Requires SQL access with VIEWACTIVITY or VIEWACTIVITYREDACTED cluster privilege for cluster-wide visibility.\nmetadata:\n  author: cockroachdb\n  version: \"1.0\"\n---\n\n# Triaging Live SQL Activity\n\nDiagnoses live cluster performance issues by identifying currently active long-running queries, busy sessions, and active transactions. Uses SQL-only interfaces (SHOW statements and `crdb_internal` views) to provide immediate triage without requiring DB Console, HTTP endpoints, or Prometheus access.\n\n## When to Use This Skill\n\n- Users report \"the cluster is slow right now\"\n- High CPU or memory usage on cluster nodes\n- Need to identify runaway queries or stuck transactions\n- Want to find which applications\u002Fusers are consuming resources\n- Require immediate triage without DB Console access\n- Need to generate SQL to cancel problematic sessions\u002Fqueries\n\n**For historical performance analysis:** Use [profiling-statement-fingerprints](..\u002Fprofiling-statement-fingerprints\u002FSKILL.md) to analyze query patterns over time, identify slow fingerprints, and investigate trends without needing live queries.\n**For transaction-level analysis:** Use [profiling-transaction-fingerprints](..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md) to analyze historical transaction retry patterns, commit latency trends, and statement composition.\n**For background job monitoring:** Use [monitoring-background-jobs](..\u002Fmonitoring-background-jobs\u002FSKILL.md) to monitor schema changes, backups, and automatic jobs that don't appear in SHOW CLUSTER STATEMENTS.\n\n## Prerequisites\n\n**Required SQL access:**\n- Connection to any CockroachDB node\n- For cluster-wide visibility: `VIEWACTIVITY` or `VIEWACTIVITYREDACTED` privilege\n  - `VIEWACTIVITYREDACTED`: Redacts constants in other users' queries (recommended for privacy)\n  - `VIEWACTIVITY`: Shows full query text for all users\n  - Without these: Only see your own sessions\u002Fqueries\n- Basic understanding of SQL query execution\n- (Optional) `CANCELQUERY` \u002F `CANCELSESSION` privileges for cancellation operations\n\n**Check your privileges:**\n```sql\nSHOW SYSTEM GRANTS FOR \u003Cusername>;\n```\n\nSee [permissions reference](references\u002Fpermissions.md) for detailed RBAC setup.\n\n## Core Diagnostic Approach\n\nCockroachDB provides SQL-only interfaces for live activity triage:\n\n| Interface | Purpose | Cluster-wide? |\n|-----------|---------|---------------|\n| `SHOW CLUSTER STATEMENTS` | Currently executing queries | Yes (with VIEWACTIVITY) |\n| `SHOW CLUSTER SESSIONS` | Active client sessions | Yes (with VIEWACTIVITY) |\n| `crdb_internal.cluster_transactions` | In-progress transactions | Yes (with VIEWACTIVITY) |\n\n**Triage workflow:**\n1. Identify long-running queries (> 5-10 minutes)\n2. Correlate to sessions and applications\n3. Check transaction retry counts (high retries = contention)\n4. Drill down by app\u002Fuser\u002Fclient\n5. (Optional) Cancel runaway work\n\n**Safety:** All diagnostic queries are read-only. Cancellation is opt-in with explicit warnings.\n\n## Core Diagnostic Queries\n\n### Long-Running Queries\n\nIdentify queries running longer than a specified threshold:\n\n```sql\n-- Queries running longer than 5 minutes\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT\n  query_id,\n  node_id,\n  session_id,\n  user_name,\n  client_address,\n  application_name,\n  start,\n  now() - start AS running_for,\n  substring(query, 1, 200) AS query_preview,\n  distributed,\n  phase\nFROM q\nWHERE start \u003C now() - INTERVAL '5 minutes'\nORDER BY start\nLIMIT 50;\n```\n\n**Key columns:**\n- `running_for`: How long the query has been executing\n- `query_preview`: First 200 characters (protects against massive queries)\n- `phase`: execution phase (preparing, executing, etc.)\n- `distributed`: whether query spans multiple nodes\n\n**Customizable thresholds:**\n- Change `INTERVAL '5 minutes'` to `'10 minutes'`, `'30 seconds'`, etc.\n- Adjust `LIMIT` based on cluster size and expected load\n\n### Active Sessions\n\nFind sessions with long-running active queries:\n\n```sql\n-- Sessions with active queries running > 5 minutes\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT\n  node_id,\n  session_id,\n  user_name,\n  client_address,\n  application_name,\n  status,\n  active_query_start,\n  now() - active_query_start AS active_query_for,\n  substring(active_queries, 1, 200) AS active_queries_preview,\n  substring(last_active_query, 1, 200) AS last_query_preview\nFROM s\nWHERE active_query_start IS NOT NULL\n  AND active_query_start \u003C now() - INTERVAL '5 minutes'\nORDER BY active_query_start\nLIMIT 50;\n```\n\n**Key columns:**\n- `active_query_for`: Duration of current active query\n- `application_name`: Source application for drill-down\n- `client_address`: Client IP\u002Fhostname for troubleshooting\n- `status`: Session state (Idle, Active, etc.)\n\n### Active Transactions\n\nIdentify long-running transactions (potential blockers):\n\n```sql\n-- Transactions running > 5 minutes\nSELECT\n  id AS txn_id,\n  node_id,\n  session_id,\n  application_name,\n  start,\n  now() - start AS running_for,\n  num_stmts,\n  num_retries,\n  num_auto_retries,\n  substring(txn_string, 1, 200) AS txn_string_preview\nFROM crdb_internal.cluster_transactions\nWHERE start \u003C now() - INTERVAL '5 minutes'\nORDER BY start\nLIMIT 50;\n```\n\n**Key columns:**\n- `num_retries` \u002F `num_auto_retries`: High retry counts indicate contention\n- `num_stmts`: Number of statements in transaction (large = potentially problematic)\n- `txn_string`: Transaction fingerprint\n\n**Production safety note:** `crdb_internal.cluster_transactions` is production-approved and safe for triage.\n\n## Drill-Down by Application, User, or Client\n\nOnce you identify suspicious activity, drill down by filtering:\n\n### Filter by Application\n\n```sql\n-- All activity from specific application\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT query_id, user_name, start, now() - start AS running_for,\n       substring(query, 1, 200) AS query_preview\nFROM q\nWHERE application_name = 'payments-api'\nORDER BY start;\n```\n\n### Filter by User\n\n```sql\n-- All activity from specific user\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT session_id, application_name, client_address,\n       active_query_start, substring(active_queries, 1, 200) AS active_queries_preview\nFROM s\nWHERE user_name = 'app_user'\n  AND active_query_start IS NOT NULL\nORDER BY active_query_start;\n```\n\n### Filter by Client Address\n\n```sql\n-- All sessions from specific client IP\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT session_id, user_name, application_name,\n       status, substring(active_queries, 1, 200) AS active_queries_preview\nFROM s\nWHERE client_address LIKE '10.0.1.%'\nORDER BY active_query_start;\n```\n\n### Combined Filters\n\n```sql\n-- Long queries from specific app and user\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT query_id, node_id, start, now() - start AS running_for,\n       substring(query, 1, 200) AS query_preview\nFROM q\nWHERE application_name = 'payments-api'\n  AND user_name = 'app_user'\n  AND start \u003C now() - INTERVAL '10 minutes'\nORDER BY start;\n```\n\n## Safety Considerations\n\n**Read-only operations:**\nAll diagnostic queries (`SHOW` statements, `crdb_internal.cluster_transactions`) are read-only and safe to run in production.\n\n**Cancellation operations (opt-in):**\n\n**CAUTION: Canceling queries\u002Fsessions terminates user work**\n\nOnly proceed if:\n- You've confirmed the query\u002Fsession is runaway or stuck\n- You have authorization to interrupt user workloads\n- You've notified stakeholders if appropriate\n- You have `CANCELQUERY` or `CANCELSESSION` privileges\n\n## Canceling Runaway Work (Opt-In)\n\n### Cancel a Specific Query\n\n```sql\n-- 1. Identify the query_id from triage queries above\n-- 2. Cancel it\nCANCEL QUERY '\u003Cquery_id>';\n```\n\n**Example:**\n```sql\nCANCEL QUERY '15f9e0e91f072f0f0000000000000001';\n```\n\n### Cancel an Entire Session\n\n```sql\n-- 1. Identify the session_id from triage queries above\n-- 2. Cancel all queries in that session\nCANCEL SESSION '\u003Csession_id>';\n```\n\n**Example:**\n```sql\nCANCEL SESSION '15f9e0e91f072f0f';\n```\n\n**Verification:**\nAfter canceling, re-run the triage queries to confirm the query\u002Fsession is gone.\n\n**Required privileges:**\n- `CANCELQUERY` system privilege to cancel queries\n- `CANCELSESSION` system privilege to cancel sessions\n- Admin role has both by default\n\nSee [permissions reference](references\u002Fpermissions.md) for granting these privileges.\n\n## Common Triage Workflows\n\n### Workflow 1: \"Cluster is slow\" investigation\n\n**Scenario:** Users report general slowness.\n\n1. **Check for long-running queries:**\n   ```sql\n   -- Run the \"Long-Running Queries\" diagnostic\n   -- Look for queries running > 5-10 minutes\n   ```\n\n2. **Identify source applications:**\n   ```sql\n   -- Group by application to find culprits\n   WITH q AS (SHOW CLUSTER STATEMENTS)\n   SELECT application_name, COUNT(*) AS num_queries,\n          AVG(now() - start) AS avg_duration\n   FROM q\n   WHERE start \u003C now() - INTERVAL '5 minutes'\n   GROUP BY application_name\n   ORDER BY num_queries DESC;\n   ```\n\n3. **Drill down into specific app:**\n   ```sql\n   -- Filter by top application from step 2\n   -- Use \"Filter by Application\" query\n   ```\n\n4. **Decide on action:**\n   - Contact app team to investigate query patterns\n   - Cancel specific runaway queries if critical\n   - Check for schema\u002Findex issues if queries are legitimate\n\n### Workflow 2: Find high-retry transactions\n\n**Scenario:** Suspect contention issues.\n\n1. **Check for high retry counts:**\n   ```sql\n   SELECT application_name, AVG(num_retries) AS avg_retries,\n          MAX(num_retries) AS max_retries, COUNT(*) AS num_txns\n   FROM crdb_internal.cluster_transactions\n   WHERE start \u003C now() - INTERVAL '5 minutes'\n   GROUP BY application_name\n   HAVING AVG(num_retries) > 5\n   ORDER BY avg_retries DESC;\n   ```\n\n2. **Investigate specific transactions:**\n   ```sql\n   -- Find transactions with >10 retries\n   SELECT id, application_name, num_retries, num_stmts,\n          substring(txn_string, 1, 200) AS txn_preview\n   FROM crdb_internal.cluster_transactions\n   WHERE num_retries > 10\n   ORDER BY num_retries DESC;\n   ```\n\n3. **Next steps:**\n   - Review transaction patterns for contention\n   - Check for lock conflicts or hotspots\n   - Consider schema changes to reduce contention\n\n### Workflow 3: Identify resource hogs by user\n\n**Scenario:** Need to attribute load to specific users.\n\n1. **Count active queries per user:**\n   ```sql\n   WITH q AS (SHOW CLUSTER STATEMENTS)\n   SELECT user_name, COUNT(*) AS num_active_queries,\n          AVG(now() - start) AS avg_duration\n   FROM q\n   GROUP BY user_name\n   ORDER BY num_active_queries DESC;\n   ```\n\n2. **Drill down to specific user's activity:**\n   ```sql\n   -- Use \"Filter by User\" query\n   ```\n\n3. **Take action:**\n   - Contact user if unexpected load\n   - Review user's query patterns\n   - Cancel if clearly runaway\n\n## Troubleshooting\n\n| Issue | Cause | Fix |\n|-------|-------|-----|\n| `SHOW CLUSTER STATEMENTS` returns empty | No active queries, or insufficient privileges | Grant `VIEWACTIVITY` or `VIEWACTIVITYREDACTED`; verify cluster has active load |\n| Query text shows `\u003Chidden>` | Using `VIEWACTIVITYREDACTED` privilege | This is expected for privacy; use `VIEWACTIVITY` if full text needed |\n| Can't cancel query: \"permission denied\" | Missing `CANCELQUERY` privilege | Grant `CANCELQUERY` system privilege to your user |\n| `crdb_internal.cluster_transactions` slow | High transaction volume on cluster | Add filters (application_name, time threshold) to reduce result set |\n| \"relation does not exist\" error | Typo in table name or old CockroachDB version | Verify you're using production-approved tables; check CockroachDB version compatibility |\n| Triage queries themselves are slow | Cluster under extreme load | Use more aggressive filters (shorter time window, specific apps); consider canceling obvious runaway work first |\n\n## Key Considerations\n\n- **Privacy:** Use `VIEWACTIVITYREDACTED` instead of `VIEWACTIVITY` to protect sensitive query constants in multi-tenant environments\n- **Performance impact:** Triage queries are read-only and lightweight, but avoid running them in tight loops during extreme load\n- **LIMIT clause:** Always include `LIMIT` to prevent overwhelming output on large clusters\n- **Time thresholds:** Adjust `INTERVAL` based on your workload (5 minutes is a reasonable default, but fast OLTP may need 30 seconds)\n- **Cancellation is disruptive:** Only cancel queries\u002Fsessions after confirming they're problematic; coordinate with application teams when possible\n- **Not for historical analysis:** These queries show current state only; for trends over time, use DB Console or Prometheus metrics\n- **Production-approved sources:** Only use `SHOW CLUSTER STATEMENTS`, `SHOW CLUSTER SESSIONS`, and `crdb_internal.cluster_transactions` for production triage\n\n## References\n\n**Skill references:**\n- [SQL query variations and examples](references\u002Fsql-queries.md)\n- [RBAC and privilege setup](references\u002Fpermissions.md)\n\n**Related skills:**\n- [profiling-statement-fingerprints](..\u002Fprofiling-statement-fingerprints\u002FSKILL.md) - For historical performance pattern analysis and trend identification\n- [profiling-transaction-fingerprints](..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md) - For historical transaction-level analysis including retry storms and commit latency\n\n**Official CockroachDB Documentation:**\n- [SHOW STATEMENTS](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fshow-statements.html)\n- [SHOW SESSIONS](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fshow-sessions.html)\n- [CANCEL QUERY](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcancel-query.html)\n- [CANCEL SESSION](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcancel-session.html)\n- [crdb_internal](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcrdb-internal.html)\n- [VIEWACTIVITY privilege](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fsecurity-reference\u002Fauthorization.html#supported-privileges)\n",{"data":40,"body":44},{"name":4,"description":6,"compatibility":41,"metadata":42},"Requires SQL access with VIEWACTIVITY or VIEWACTIVITYREDACTED cluster privilege for cluster-wide visibility.",{"author":8,"version":43},"1.0",{"type":45,"children":46},"root",[47,55,70,77,112,160,166,174,257,265,285,298,304,309,406,414,443,453,459,466,471,637,645,692,700,745,751,756,900,907,954,960,965,1091,1098,1141,1158,1164,1169,1175,1236,1242,1311,1317,1377,1383,1457,1463,1488,1496,1504,1509,1545,1551,1557,1588,1596,1610,1616,1647,1654,1668,1678,1686,1714,1724,1730,1736,1746,1913,1919,1928,2087,2093,2102,2213,2219,2409,2415,2536,2542,2550,2570,2578,2599,2607,2670],{"type":48,"tag":49,"props":50,"children":51},"element","h1",{"id":4},[52],{"type":53,"value":54},"text","Triaging Live SQL Activity",{"type":48,"tag":56,"props":57,"children":58},"p",{},[59,61,68],{"type":53,"value":60},"Diagnoses live cluster performance issues by identifying currently active long-running queries, busy sessions, and active transactions. Uses SQL-only interfaces (SHOW statements and ",{"type":48,"tag":62,"props":63,"children":65},"code",{"className":64},[],[66],{"type":53,"value":67},"crdb_internal",{"type":53,"value":69}," views) to provide immediate triage without requiring DB Console, HTTP endpoints, or Prometheus access.",{"type":48,"tag":71,"props":72,"children":74},"h2",{"id":73},"when-to-use-this-skill",[75],{"type":53,"value":76},"When to Use This Skill",{"type":48,"tag":78,"props":79,"children":80},"ul",{},[81,87,92,97,102,107],{"type":48,"tag":82,"props":83,"children":84},"li",{},[85],{"type":53,"value":86},"Users report \"the cluster is slow right now\"",{"type":48,"tag":82,"props":88,"children":89},{},[90],{"type":53,"value":91},"High CPU or memory usage on cluster nodes",{"type":48,"tag":82,"props":93,"children":94},{},[95],{"type":53,"value":96},"Need to identify runaway queries or stuck transactions",{"type":48,"tag":82,"props":98,"children":99},{},[100],{"type":53,"value":101},"Want to find which applications\u002Fusers are consuming resources",{"type":48,"tag":82,"props":103,"children":104},{},[105],{"type":53,"value":106},"Require immediate triage without DB Console access",{"type":48,"tag":82,"props":108,"children":109},{},[110],{"type":53,"value":111},"Need to generate SQL to cancel problematic sessions\u002Fqueries",{"type":48,"tag":56,"props":113,"children":114},{},[115,121,123,130,132,137,138,144,146,151,152,158],{"type":48,"tag":116,"props":117,"children":118},"strong",{},[119],{"type":53,"value":120},"For historical performance analysis:",{"type":53,"value":122}," Use ",{"type":48,"tag":124,"props":125,"children":127},"a",{"href":126},"..\u002Fprofiling-statement-fingerprints\u002FSKILL.md",[128],{"type":53,"value":129},"profiling-statement-fingerprints",{"type":53,"value":131}," to analyze query patterns over time, identify slow fingerprints, and investigate trends without needing live queries.\n",{"type":48,"tag":116,"props":133,"children":134},{},[135],{"type":53,"value":136},"For transaction-level analysis:",{"type":53,"value":122},{"type":48,"tag":124,"props":139,"children":141},{"href":140},"..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md",[142],{"type":53,"value":143},"profiling-transaction-fingerprints",{"type":53,"value":145}," to analyze historical transaction retry patterns, commit latency trends, and statement composition.\n",{"type":48,"tag":116,"props":147,"children":148},{},[149],{"type":53,"value":150},"For background job monitoring:",{"type":53,"value":122},{"type":48,"tag":124,"props":153,"children":155},{"href":154},"..\u002Fmonitoring-background-jobs\u002FSKILL.md",[156],{"type":53,"value":157},"monitoring-background-jobs",{"type":53,"value":159}," to monitor schema changes, backups, and automatic jobs that don't appear in SHOW CLUSTER STATEMENTS.",{"type":48,"tag":71,"props":161,"children":163},{"id":162},"prerequisites",[164],{"type":53,"value":165},"Prerequisites",{"type":48,"tag":56,"props":167,"children":168},{},[169],{"type":48,"tag":116,"props":170,"children":171},{},[172],{"type":53,"value":173},"Required SQL access:",{"type":48,"tag":78,"props":175,"children":176},{},[177,182,231,236],{"type":48,"tag":82,"props":178,"children":179},{},[180],{"type":53,"value":181},"Connection to any CockroachDB node",{"type":48,"tag":82,"props":183,"children":184},{},[185,187,193,195,201,203],{"type":53,"value":186},"For cluster-wide visibility: ",{"type":48,"tag":62,"props":188,"children":190},{"className":189},[],[191],{"type":53,"value":192},"VIEWACTIVITY",{"type":53,"value":194}," or ",{"type":48,"tag":62,"props":196,"children":198},{"className":197},[],[199],{"type":53,"value":200},"VIEWACTIVITYREDACTED",{"type":53,"value":202}," privilege\n",{"type":48,"tag":78,"props":204,"children":205},{},[206,216,226],{"type":48,"tag":82,"props":207,"children":208},{},[209,214],{"type":48,"tag":62,"props":210,"children":212},{"className":211},[],[213],{"type":53,"value":200},{"type":53,"value":215},": Redacts constants in other users' queries (recommended for privacy)",{"type":48,"tag":82,"props":217,"children":218},{},[219,224],{"type":48,"tag":62,"props":220,"children":222},{"className":221},[],[223],{"type":53,"value":192},{"type":53,"value":225},": Shows full query text for all users",{"type":48,"tag":82,"props":227,"children":228},{},[229],{"type":53,"value":230},"Without these: Only see your own sessions\u002Fqueries",{"type":48,"tag":82,"props":232,"children":233},{},[234],{"type":53,"value":235},"Basic understanding of SQL query execution",{"type":48,"tag":82,"props":237,"children":238},{},[239,241,247,249,255],{"type":53,"value":240},"(Optional) ",{"type":48,"tag":62,"props":242,"children":244},{"className":243},[],[245],{"type":53,"value":246},"CANCELQUERY",{"type":53,"value":248}," \u002F ",{"type":48,"tag":62,"props":250,"children":252},{"className":251},[],[253],{"type":53,"value":254},"CANCELSESSION",{"type":53,"value":256}," privileges for cancellation operations",{"type":48,"tag":56,"props":258,"children":259},{},[260],{"type":48,"tag":116,"props":261,"children":262},{},[263],{"type":53,"value":264},"Check your privileges:",{"type":48,"tag":266,"props":267,"children":271},"pre",{"className":268,"code":269,"language":21,"meta":270,"style":270},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","SHOW SYSTEM GRANTS FOR \u003Cusername>;\n","",[272],{"type":48,"tag":62,"props":273,"children":274},{"__ignoreMap":270},[275],{"type":48,"tag":276,"props":277,"children":280},"span",{"class":278,"line":279},"line",1,[281],{"type":48,"tag":276,"props":282,"children":283},{},[284],{"type":53,"value":269},{"type":48,"tag":56,"props":286,"children":287},{},[288,290,296],{"type":53,"value":289},"See ",{"type":48,"tag":124,"props":291,"children":293},{"href":292},"references\u002Fpermissions.md",[294],{"type":53,"value":295},"permissions reference",{"type":53,"value":297}," for detailed RBAC setup.",{"type":48,"tag":71,"props":299,"children":301},{"id":300},"core-diagnostic-approach",[302],{"type":53,"value":303},"Core Diagnostic Approach",{"type":48,"tag":56,"props":305,"children":306},{},[307],{"type":53,"value":308},"CockroachDB provides SQL-only interfaces for live activity triage:",{"type":48,"tag":310,"props":311,"children":312},"table",{},[313,337],{"type":48,"tag":314,"props":315,"children":316},"thead",{},[317],{"type":48,"tag":318,"props":319,"children":320},"tr",{},[321,327,332],{"type":48,"tag":322,"props":323,"children":324},"th",{},[325],{"type":53,"value":326},"Interface",{"type":48,"tag":322,"props":328,"children":329},{},[330],{"type":53,"value":331},"Purpose",{"type":48,"tag":322,"props":333,"children":334},{},[335],{"type":53,"value":336},"Cluster-wide?",{"type":48,"tag":338,"props":339,"children":340},"tbody",{},[341,364,385],{"type":48,"tag":318,"props":342,"children":343},{},[344,354,359],{"type":48,"tag":345,"props":346,"children":347},"td",{},[348],{"type":48,"tag":62,"props":349,"children":351},{"className":350},[],[352],{"type":53,"value":353},"SHOW CLUSTER STATEMENTS",{"type":48,"tag":345,"props":355,"children":356},{},[357],{"type":53,"value":358},"Currently executing queries",{"type":48,"tag":345,"props":360,"children":361},{},[362],{"type":53,"value":363},"Yes (with VIEWACTIVITY)",{"type":48,"tag":318,"props":365,"children":366},{},[367,376,381],{"type":48,"tag":345,"props":368,"children":369},{},[370],{"type":48,"tag":62,"props":371,"children":373},{"className":372},[],[374],{"type":53,"value":375},"SHOW CLUSTER SESSIONS",{"type":48,"tag":345,"props":377,"children":378},{},[379],{"type":53,"value":380},"Active client sessions",{"type":48,"tag":345,"props":382,"children":383},{},[384],{"type":53,"value":363},{"type":48,"tag":318,"props":386,"children":387},{},[388,397,402],{"type":48,"tag":345,"props":389,"children":390},{},[391],{"type":48,"tag":62,"props":392,"children":394},{"className":393},[],[395],{"type":53,"value":396},"crdb_internal.cluster_transactions",{"type":48,"tag":345,"props":398,"children":399},{},[400],{"type":53,"value":401},"In-progress transactions",{"type":48,"tag":345,"props":403,"children":404},{},[405],{"type":53,"value":363},{"type":48,"tag":56,"props":407,"children":408},{},[409],{"type":48,"tag":116,"props":410,"children":411},{},[412],{"type":53,"value":413},"Triage workflow:",{"type":48,"tag":415,"props":416,"children":417},"ol",{},[418,423,428,433,438],{"type":48,"tag":82,"props":419,"children":420},{},[421],{"type":53,"value":422},"Identify long-running queries (> 5-10 minutes)",{"type":48,"tag":82,"props":424,"children":425},{},[426],{"type":53,"value":427},"Correlate to sessions and applications",{"type":48,"tag":82,"props":429,"children":430},{},[431],{"type":53,"value":432},"Check transaction retry counts (high retries = contention)",{"type":48,"tag":82,"props":434,"children":435},{},[436],{"type":53,"value":437},"Drill down by app\u002Fuser\u002Fclient",{"type":48,"tag":82,"props":439,"children":440},{},[441],{"type":53,"value":442},"(Optional) Cancel runaway work",{"type":48,"tag":56,"props":444,"children":445},{},[446,451],{"type":48,"tag":116,"props":447,"children":448},{},[449],{"type":53,"value":450},"Safety:",{"type":53,"value":452}," All diagnostic queries are read-only. Cancellation is opt-in with explicit warnings.",{"type":48,"tag":71,"props":454,"children":456},{"id":455},"core-diagnostic-queries",[457],{"type":53,"value":458},"Core Diagnostic Queries",{"type":48,"tag":460,"props":461,"children":463},"h3",{"id":462},"long-running-queries",[464],{"type":53,"value":465},"Long-Running Queries",{"type":48,"tag":56,"props":467,"children":468},{},[469],{"type":53,"value":470},"Identify queries running longer than a specified threshold:",{"type":48,"tag":266,"props":472,"children":474},{"className":268,"code":473,"language":21,"meta":270,"style":270},"-- Queries running longer than 5 minutes\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT\n  query_id,\n  node_id,\n  session_id,\n  user_name,\n  client_address,\n  application_name,\n  start,\n  now() - start AS running_for,\n  substring(query, 1, 200) AS query_preview,\n  distributed,\n  phase\nFROM q\nWHERE start \u003C now() - INTERVAL '5 minutes'\nORDER BY start\nLIMIT 50;\n",[475],{"type":48,"tag":62,"props":476,"children":477},{"__ignoreMap":270},[478,486,494,502,511,520,529,538,547,556,565,574,583,592,601,610,619,628],{"type":48,"tag":276,"props":479,"children":480},{"class":278,"line":279},[481],{"type":48,"tag":276,"props":482,"children":483},{},[484],{"type":53,"value":485},"-- Queries running longer than 5 minutes\n",{"type":48,"tag":276,"props":487,"children":488},{"class":278,"line":29},[489],{"type":48,"tag":276,"props":490,"children":491},{},[492],{"type":53,"value":493},"WITH q AS (SHOW CLUSTER STATEMENTS)\n",{"type":48,"tag":276,"props":495,"children":496},{"class":278,"line":25},[497],{"type":48,"tag":276,"props":498,"children":499},{},[500],{"type":53,"value":501},"SELECT\n",{"type":48,"tag":276,"props":503,"children":505},{"class":278,"line":504},4,[506],{"type":48,"tag":276,"props":507,"children":508},{},[509],{"type":53,"value":510},"  query_id,\n",{"type":48,"tag":276,"props":512,"children":514},{"class":278,"line":513},5,[515],{"type":48,"tag":276,"props":516,"children":517},{},[518],{"type":53,"value":519},"  node_id,\n",{"type":48,"tag":276,"props":521,"children":523},{"class":278,"line":522},6,[524],{"type":48,"tag":276,"props":525,"children":526},{},[527],{"type":53,"value":528},"  session_id,\n",{"type":48,"tag":276,"props":530,"children":532},{"class":278,"line":531},7,[533],{"type":48,"tag":276,"props":534,"children":535},{},[536],{"type":53,"value":537},"  user_name,\n",{"type":48,"tag":276,"props":539,"children":541},{"class":278,"line":540},8,[542],{"type":48,"tag":276,"props":543,"children":544},{},[545],{"type":53,"value":546},"  client_address,\n",{"type":48,"tag":276,"props":548,"children":550},{"class":278,"line":549},9,[551],{"type":48,"tag":276,"props":552,"children":553},{},[554],{"type":53,"value":555},"  application_name,\n",{"type":48,"tag":276,"props":557,"children":559},{"class":278,"line":558},10,[560],{"type":48,"tag":276,"props":561,"children":562},{},[563],{"type":53,"value":564},"  start,\n",{"type":48,"tag":276,"props":566,"children":568},{"class":278,"line":567},11,[569],{"type":48,"tag":276,"props":570,"children":571},{},[572],{"type":53,"value":573},"  now() - start AS running_for,\n",{"type":48,"tag":276,"props":575,"children":577},{"class":278,"line":576},12,[578],{"type":48,"tag":276,"props":579,"children":580},{},[581],{"type":53,"value":582},"  substring(query, 1, 200) AS query_preview,\n",{"type":48,"tag":276,"props":584,"children":586},{"class":278,"line":585},13,[587],{"type":48,"tag":276,"props":588,"children":589},{},[590],{"type":53,"value":591},"  distributed,\n",{"type":48,"tag":276,"props":593,"children":595},{"class":278,"line":594},14,[596],{"type":48,"tag":276,"props":597,"children":598},{},[599],{"type":53,"value":600},"  phase\n",{"type":48,"tag":276,"props":602,"children":604},{"class":278,"line":603},15,[605],{"type":48,"tag":276,"props":606,"children":607},{},[608],{"type":53,"value":609},"FROM q\n",{"type":48,"tag":276,"props":611,"children":613},{"class":278,"line":612},16,[614],{"type":48,"tag":276,"props":615,"children":616},{},[617],{"type":53,"value":618},"WHERE start \u003C now() - INTERVAL '5 minutes'\n",{"type":48,"tag":276,"props":620,"children":622},{"class":278,"line":621},17,[623],{"type":48,"tag":276,"props":624,"children":625},{},[626],{"type":53,"value":627},"ORDER BY start\n",{"type":48,"tag":276,"props":629,"children":631},{"class":278,"line":630},18,[632],{"type":48,"tag":276,"props":633,"children":634},{},[635],{"type":53,"value":636},"LIMIT 50;\n",{"type":48,"tag":56,"props":638,"children":639},{},[640],{"type":48,"tag":116,"props":641,"children":642},{},[643],{"type":53,"value":644},"Key columns:",{"type":48,"tag":78,"props":646,"children":647},{},[648,659,670,681],{"type":48,"tag":82,"props":649,"children":650},{},[651,657],{"type":48,"tag":62,"props":652,"children":654},{"className":653},[],[655],{"type":53,"value":656},"running_for",{"type":53,"value":658},": How long the query has been executing",{"type":48,"tag":82,"props":660,"children":661},{},[662,668],{"type":48,"tag":62,"props":663,"children":665},{"className":664},[],[666],{"type":53,"value":667},"query_preview",{"type":53,"value":669},": First 200 characters (protects against massive queries)",{"type":48,"tag":82,"props":671,"children":672},{},[673,679],{"type":48,"tag":62,"props":674,"children":676},{"className":675},[],[677],{"type":53,"value":678},"phase",{"type":53,"value":680},": execution phase (preparing, executing, etc.)",{"type":48,"tag":82,"props":682,"children":683},{},[684,690],{"type":48,"tag":62,"props":685,"children":687},{"className":686},[],[688],{"type":53,"value":689},"distributed",{"type":53,"value":691},": whether query spans multiple nodes",{"type":48,"tag":56,"props":693,"children":694},{},[695],{"type":48,"tag":116,"props":696,"children":697},{},[698],{"type":53,"value":699},"Customizable thresholds:",{"type":48,"tag":78,"props":701,"children":702},{},[703,732],{"type":48,"tag":82,"props":704,"children":705},{},[706,708,714,716,722,724,730],{"type":53,"value":707},"Change ",{"type":48,"tag":62,"props":709,"children":711},{"className":710},[],[712],{"type":53,"value":713},"INTERVAL '5 minutes'",{"type":53,"value":715}," to ",{"type":48,"tag":62,"props":717,"children":719},{"className":718},[],[720],{"type":53,"value":721},"'10 minutes'",{"type":53,"value":723},", ",{"type":48,"tag":62,"props":725,"children":727},{"className":726},[],[728],{"type":53,"value":729},"'30 seconds'",{"type":53,"value":731},", etc.",{"type":48,"tag":82,"props":733,"children":734},{},[735,737,743],{"type":53,"value":736},"Adjust ",{"type":48,"tag":62,"props":738,"children":740},{"className":739},[],[741],{"type":53,"value":742},"LIMIT",{"type":53,"value":744}," based on cluster size and expected load",{"type":48,"tag":460,"props":746,"children":748},{"id":747},"active-sessions",[749],{"type":53,"value":750},"Active Sessions",{"type":48,"tag":56,"props":752,"children":753},{},[754],{"type":53,"value":755},"Find sessions with long-running active queries:",{"type":48,"tag":266,"props":757,"children":759},{"className":268,"code":758,"language":21,"meta":270,"style":270},"-- Sessions with active queries running > 5 minutes\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT\n  node_id,\n  session_id,\n  user_name,\n  client_address,\n  application_name,\n  status,\n  active_query_start,\n  now() - active_query_start AS active_query_for,\n  substring(active_queries, 1, 200) AS active_queries_preview,\n  substring(last_active_query, 1, 200) AS last_query_preview\nFROM s\nWHERE active_query_start IS NOT NULL\n  AND active_query_start \u003C now() - INTERVAL '5 minutes'\nORDER BY active_query_start\nLIMIT 50;\n",[760],{"type":48,"tag":62,"props":761,"children":762},{"__ignoreMap":270},[763,771,779,786,793,800,807,814,821,829,837,845,853,861,869,877,885,893],{"type":48,"tag":276,"props":764,"children":765},{"class":278,"line":279},[766],{"type":48,"tag":276,"props":767,"children":768},{},[769],{"type":53,"value":770},"-- Sessions with active queries running > 5 minutes\n",{"type":48,"tag":276,"props":772,"children":773},{"class":278,"line":29},[774],{"type":48,"tag":276,"props":775,"children":776},{},[777],{"type":53,"value":778},"WITH s AS (SHOW CLUSTER SESSIONS)\n",{"type":48,"tag":276,"props":780,"children":781},{"class":278,"line":25},[782],{"type":48,"tag":276,"props":783,"children":784},{},[785],{"type":53,"value":501},{"type":48,"tag":276,"props":787,"children":788},{"class":278,"line":504},[789],{"type":48,"tag":276,"props":790,"children":791},{},[792],{"type":53,"value":519},{"type":48,"tag":276,"props":794,"children":795},{"class":278,"line":513},[796],{"type":48,"tag":276,"props":797,"children":798},{},[799],{"type":53,"value":528},{"type":48,"tag":276,"props":801,"children":802},{"class":278,"line":522},[803],{"type":48,"tag":276,"props":804,"children":805},{},[806],{"type":53,"value":537},{"type":48,"tag":276,"props":808,"children":809},{"class":278,"line":531},[810],{"type":48,"tag":276,"props":811,"children":812},{},[813],{"type":53,"value":546},{"type":48,"tag":276,"props":815,"children":816},{"class":278,"line":540},[817],{"type":48,"tag":276,"props":818,"children":819},{},[820],{"type":53,"value":555},{"type":48,"tag":276,"props":822,"children":823},{"class":278,"line":549},[824],{"type":48,"tag":276,"props":825,"children":826},{},[827],{"type":53,"value":828},"  status,\n",{"type":48,"tag":276,"props":830,"children":831},{"class":278,"line":558},[832],{"type":48,"tag":276,"props":833,"children":834},{},[835],{"type":53,"value":836},"  active_query_start,\n",{"type":48,"tag":276,"props":838,"children":839},{"class":278,"line":567},[840],{"type":48,"tag":276,"props":841,"children":842},{},[843],{"type":53,"value":844},"  now() - active_query_start AS active_query_for,\n",{"type":48,"tag":276,"props":846,"children":847},{"class":278,"line":576},[848],{"type":48,"tag":276,"props":849,"children":850},{},[851],{"type":53,"value":852},"  substring(active_queries, 1, 200) AS active_queries_preview,\n",{"type":48,"tag":276,"props":854,"children":855},{"class":278,"line":585},[856],{"type":48,"tag":276,"props":857,"children":858},{},[859],{"type":53,"value":860},"  substring(last_active_query, 1, 200) AS last_query_preview\n",{"type":48,"tag":276,"props":862,"children":863},{"class":278,"line":594},[864],{"type":48,"tag":276,"props":865,"children":866},{},[867],{"type":53,"value":868},"FROM s\n",{"type":48,"tag":276,"props":870,"children":871},{"class":278,"line":603},[872],{"type":48,"tag":276,"props":873,"children":874},{},[875],{"type":53,"value":876},"WHERE active_query_start IS NOT NULL\n",{"type":48,"tag":276,"props":878,"children":879},{"class":278,"line":612},[880],{"type":48,"tag":276,"props":881,"children":882},{},[883],{"type":53,"value":884},"  AND active_query_start \u003C now() - INTERVAL '5 minutes'\n",{"type":48,"tag":276,"props":886,"children":887},{"class":278,"line":621},[888],{"type":48,"tag":276,"props":889,"children":890},{},[891],{"type":53,"value":892},"ORDER BY active_query_start\n",{"type":48,"tag":276,"props":894,"children":895},{"class":278,"line":630},[896],{"type":48,"tag":276,"props":897,"children":898},{},[899],{"type":53,"value":636},{"type":48,"tag":56,"props":901,"children":902},{},[903],{"type":48,"tag":116,"props":904,"children":905},{},[906],{"type":53,"value":644},{"type":48,"tag":78,"props":908,"children":909},{},[910,921,932,943],{"type":48,"tag":82,"props":911,"children":912},{},[913,919],{"type":48,"tag":62,"props":914,"children":916},{"className":915},[],[917],{"type":53,"value":918},"active_query_for",{"type":53,"value":920},": Duration of current active query",{"type":48,"tag":82,"props":922,"children":923},{},[924,930],{"type":48,"tag":62,"props":925,"children":927},{"className":926},[],[928],{"type":53,"value":929},"application_name",{"type":53,"value":931},": Source application for drill-down",{"type":48,"tag":82,"props":933,"children":934},{},[935,941],{"type":48,"tag":62,"props":936,"children":938},{"className":937},[],[939],{"type":53,"value":940},"client_address",{"type":53,"value":942},": Client IP\u002Fhostname for troubleshooting",{"type":48,"tag":82,"props":944,"children":945},{},[946,952],{"type":48,"tag":62,"props":947,"children":949},{"className":948},[],[950],{"type":53,"value":951},"status",{"type":53,"value":953},": Session state (Idle, Active, etc.)",{"type":48,"tag":460,"props":955,"children":957},{"id":956},"active-transactions",[958],{"type":53,"value":959},"Active Transactions",{"type":48,"tag":56,"props":961,"children":962},{},[963],{"type":53,"value":964},"Identify long-running transactions (potential blockers):",{"type":48,"tag":266,"props":966,"children":968},{"className":268,"code":967,"language":21,"meta":270,"style":270},"-- Transactions running > 5 minutes\nSELECT\n  id AS txn_id,\n  node_id,\n  session_id,\n  application_name,\n  start,\n  now() - start AS running_for,\n  num_stmts,\n  num_retries,\n  num_auto_retries,\n  substring(txn_string, 1, 200) AS txn_string_preview\nFROM crdb_internal.cluster_transactions\nWHERE start \u003C now() - INTERVAL '5 minutes'\nORDER BY start\nLIMIT 50;\n",[969],{"type":48,"tag":62,"props":970,"children":971},{"__ignoreMap":270},[972,980,987,995,1002,1009,1016,1023,1030,1038,1046,1054,1062,1070,1077,1084],{"type":48,"tag":276,"props":973,"children":974},{"class":278,"line":279},[975],{"type":48,"tag":276,"props":976,"children":977},{},[978],{"type":53,"value":979},"-- Transactions running > 5 minutes\n",{"type":48,"tag":276,"props":981,"children":982},{"class":278,"line":29},[983],{"type":48,"tag":276,"props":984,"children":985},{},[986],{"type":53,"value":501},{"type":48,"tag":276,"props":988,"children":989},{"class":278,"line":25},[990],{"type":48,"tag":276,"props":991,"children":992},{},[993],{"type":53,"value":994},"  id AS txn_id,\n",{"type":48,"tag":276,"props":996,"children":997},{"class":278,"line":504},[998],{"type":48,"tag":276,"props":999,"children":1000},{},[1001],{"type":53,"value":519},{"type":48,"tag":276,"props":1003,"children":1004},{"class":278,"line":513},[1005],{"type":48,"tag":276,"props":1006,"children":1007},{},[1008],{"type":53,"value":528},{"type":48,"tag":276,"props":1010,"children":1011},{"class":278,"line":522},[1012],{"type":48,"tag":276,"props":1013,"children":1014},{},[1015],{"type":53,"value":555},{"type":48,"tag":276,"props":1017,"children":1018},{"class":278,"line":531},[1019],{"type":48,"tag":276,"props":1020,"children":1021},{},[1022],{"type":53,"value":564},{"type":48,"tag":276,"props":1024,"children":1025},{"class":278,"line":540},[1026],{"type":48,"tag":276,"props":1027,"children":1028},{},[1029],{"type":53,"value":573},{"type":48,"tag":276,"props":1031,"children":1032},{"class":278,"line":549},[1033],{"type":48,"tag":276,"props":1034,"children":1035},{},[1036],{"type":53,"value":1037},"  num_stmts,\n",{"type":48,"tag":276,"props":1039,"children":1040},{"class":278,"line":558},[1041],{"type":48,"tag":276,"props":1042,"children":1043},{},[1044],{"type":53,"value":1045},"  num_retries,\n",{"type":48,"tag":276,"props":1047,"children":1048},{"class":278,"line":567},[1049],{"type":48,"tag":276,"props":1050,"children":1051},{},[1052],{"type":53,"value":1053},"  num_auto_retries,\n",{"type":48,"tag":276,"props":1055,"children":1056},{"class":278,"line":576},[1057],{"type":48,"tag":276,"props":1058,"children":1059},{},[1060],{"type":53,"value":1061},"  substring(txn_string, 1, 200) AS txn_string_preview\n",{"type":48,"tag":276,"props":1063,"children":1064},{"class":278,"line":585},[1065],{"type":48,"tag":276,"props":1066,"children":1067},{},[1068],{"type":53,"value":1069},"FROM crdb_internal.cluster_transactions\n",{"type":48,"tag":276,"props":1071,"children":1072},{"class":278,"line":594},[1073],{"type":48,"tag":276,"props":1074,"children":1075},{},[1076],{"type":53,"value":618},{"type":48,"tag":276,"props":1078,"children":1079},{"class":278,"line":603},[1080],{"type":48,"tag":276,"props":1081,"children":1082},{},[1083],{"type":53,"value":627},{"type":48,"tag":276,"props":1085,"children":1086},{"class":278,"line":612},[1087],{"type":48,"tag":276,"props":1088,"children":1089},{},[1090],{"type":53,"value":636},{"type":48,"tag":56,"props":1092,"children":1093},{},[1094],{"type":48,"tag":116,"props":1095,"children":1096},{},[1097],{"type":53,"value":644},{"type":48,"tag":78,"props":1099,"children":1100},{},[1101,1119,1130],{"type":48,"tag":82,"props":1102,"children":1103},{},[1104,1110,1111,1117],{"type":48,"tag":62,"props":1105,"children":1107},{"className":1106},[],[1108],{"type":53,"value":1109},"num_retries",{"type":53,"value":248},{"type":48,"tag":62,"props":1112,"children":1114},{"className":1113},[],[1115],{"type":53,"value":1116},"num_auto_retries",{"type":53,"value":1118},": High retry counts indicate contention",{"type":48,"tag":82,"props":1120,"children":1121},{},[1122,1128],{"type":48,"tag":62,"props":1123,"children":1125},{"className":1124},[],[1126],{"type":53,"value":1127},"num_stmts",{"type":53,"value":1129},": Number of statements in transaction (large = potentially problematic)",{"type":48,"tag":82,"props":1131,"children":1132},{},[1133,1139],{"type":48,"tag":62,"props":1134,"children":1136},{"className":1135},[],[1137],{"type":53,"value":1138},"txn_string",{"type":53,"value":1140},": Transaction fingerprint",{"type":48,"tag":56,"props":1142,"children":1143},{},[1144,1149,1151,1156],{"type":48,"tag":116,"props":1145,"children":1146},{},[1147],{"type":53,"value":1148},"Production safety note:",{"type":53,"value":1150}," ",{"type":48,"tag":62,"props":1152,"children":1154},{"className":1153},[],[1155],{"type":53,"value":396},{"type":53,"value":1157}," is production-approved and safe for triage.",{"type":48,"tag":71,"props":1159,"children":1161},{"id":1160},"drill-down-by-application-user-or-client",[1162],{"type":53,"value":1163},"Drill-Down by Application, User, or Client",{"type":48,"tag":56,"props":1165,"children":1166},{},[1167],{"type":53,"value":1168},"Once you identify suspicious activity, drill down by filtering:",{"type":48,"tag":460,"props":1170,"children":1172},{"id":1171},"filter-by-application",[1173],{"type":53,"value":1174},"Filter by Application",{"type":48,"tag":266,"props":1176,"children":1178},{"className":268,"code":1177,"language":21,"meta":270,"style":270},"-- All activity from specific application\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT query_id, user_name, start, now() - start AS running_for,\n       substring(query, 1, 200) AS query_preview\nFROM q\nWHERE application_name = 'payments-api'\nORDER BY start;\n",[1179],{"type":48,"tag":62,"props":1180,"children":1181},{"__ignoreMap":270},[1182,1190,1197,1205,1213,1220,1228],{"type":48,"tag":276,"props":1183,"children":1184},{"class":278,"line":279},[1185],{"type":48,"tag":276,"props":1186,"children":1187},{},[1188],{"type":53,"value":1189},"-- All activity from specific application\n",{"type":48,"tag":276,"props":1191,"children":1192},{"class":278,"line":29},[1193],{"type":48,"tag":276,"props":1194,"children":1195},{},[1196],{"type":53,"value":493},{"type":48,"tag":276,"props":1198,"children":1199},{"class":278,"line":25},[1200],{"type":48,"tag":276,"props":1201,"children":1202},{},[1203],{"type":53,"value":1204},"SELECT query_id, user_name, start, now() - start AS running_for,\n",{"type":48,"tag":276,"props":1206,"children":1207},{"class":278,"line":504},[1208],{"type":48,"tag":276,"props":1209,"children":1210},{},[1211],{"type":53,"value":1212},"       substring(query, 1, 200) AS query_preview\n",{"type":48,"tag":276,"props":1214,"children":1215},{"class":278,"line":513},[1216],{"type":48,"tag":276,"props":1217,"children":1218},{},[1219],{"type":53,"value":609},{"type":48,"tag":276,"props":1221,"children":1222},{"class":278,"line":522},[1223],{"type":48,"tag":276,"props":1224,"children":1225},{},[1226],{"type":53,"value":1227},"WHERE application_name = 'payments-api'\n",{"type":48,"tag":276,"props":1229,"children":1230},{"class":278,"line":531},[1231],{"type":48,"tag":276,"props":1232,"children":1233},{},[1234],{"type":53,"value":1235},"ORDER BY start;\n",{"type":48,"tag":460,"props":1237,"children":1239},{"id":1238},"filter-by-user",[1240],{"type":53,"value":1241},"Filter by User",{"type":48,"tag":266,"props":1243,"children":1245},{"className":268,"code":1244,"language":21,"meta":270,"style":270},"-- All activity from specific user\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT session_id, application_name, client_address,\n       active_query_start, substring(active_queries, 1, 200) AS active_queries_preview\nFROM s\nWHERE user_name = 'app_user'\n  AND active_query_start IS NOT NULL\nORDER BY active_query_start;\n",[1246],{"type":48,"tag":62,"props":1247,"children":1248},{"__ignoreMap":270},[1249,1257,1264,1272,1280,1287,1295,1303],{"type":48,"tag":276,"props":1250,"children":1251},{"class":278,"line":279},[1252],{"type":48,"tag":276,"props":1253,"children":1254},{},[1255],{"type":53,"value":1256},"-- All activity from specific user\n",{"type":48,"tag":276,"props":1258,"children":1259},{"class":278,"line":29},[1260],{"type":48,"tag":276,"props":1261,"children":1262},{},[1263],{"type":53,"value":778},{"type":48,"tag":276,"props":1265,"children":1266},{"class":278,"line":25},[1267],{"type":48,"tag":276,"props":1268,"children":1269},{},[1270],{"type":53,"value":1271},"SELECT session_id, application_name, client_address,\n",{"type":48,"tag":276,"props":1273,"children":1274},{"class":278,"line":504},[1275],{"type":48,"tag":276,"props":1276,"children":1277},{},[1278],{"type":53,"value":1279},"       active_query_start, substring(active_queries, 1, 200) AS active_queries_preview\n",{"type":48,"tag":276,"props":1281,"children":1282},{"class":278,"line":513},[1283],{"type":48,"tag":276,"props":1284,"children":1285},{},[1286],{"type":53,"value":868},{"type":48,"tag":276,"props":1288,"children":1289},{"class":278,"line":522},[1290],{"type":48,"tag":276,"props":1291,"children":1292},{},[1293],{"type":53,"value":1294},"WHERE user_name = 'app_user'\n",{"type":48,"tag":276,"props":1296,"children":1297},{"class":278,"line":531},[1298],{"type":48,"tag":276,"props":1299,"children":1300},{},[1301],{"type":53,"value":1302},"  AND active_query_start IS NOT NULL\n",{"type":48,"tag":276,"props":1304,"children":1305},{"class":278,"line":540},[1306],{"type":48,"tag":276,"props":1307,"children":1308},{},[1309],{"type":53,"value":1310},"ORDER BY active_query_start;\n",{"type":48,"tag":460,"props":1312,"children":1314},{"id":1313},"filter-by-client-address",[1315],{"type":53,"value":1316},"Filter by Client Address",{"type":48,"tag":266,"props":1318,"children":1320},{"className":268,"code":1319,"language":21,"meta":270,"style":270},"-- All sessions from specific client IP\nWITH s AS (SHOW CLUSTER SESSIONS)\nSELECT session_id, user_name, application_name,\n       status, substring(active_queries, 1, 200) AS active_queries_preview\nFROM s\nWHERE client_address LIKE '10.0.1.%'\nORDER BY active_query_start;\n",[1321],{"type":48,"tag":62,"props":1322,"children":1323},{"__ignoreMap":270},[1324,1332,1339,1347,1355,1362,1370],{"type":48,"tag":276,"props":1325,"children":1326},{"class":278,"line":279},[1327],{"type":48,"tag":276,"props":1328,"children":1329},{},[1330],{"type":53,"value":1331},"-- All sessions from specific client IP\n",{"type":48,"tag":276,"props":1333,"children":1334},{"class":278,"line":29},[1335],{"type":48,"tag":276,"props":1336,"children":1337},{},[1338],{"type":53,"value":778},{"type":48,"tag":276,"props":1340,"children":1341},{"class":278,"line":25},[1342],{"type":48,"tag":276,"props":1343,"children":1344},{},[1345],{"type":53,"value":1346},"SELECT session_id, user_name, application_name,\n",{"type":48,"tag":276,"props":1348,"children":1349},{"class":278,"line":504},[1350],{"type":48,"tag":276,"props":1351,"children":1352},{},[1353],{"type":53,"value":1354},"       status, substring(active_queries, 1, 200) AS active_queries_preview\n",{"type":48,"tag":276,"props":1356,"children":1357},{"class":278,"line":513},[1358],{"type":48,"tag":276,"props":1359,"children":1360},{},[1361],{"type":53,"value":868},{"type":48,"tag":276,"props":1363,"children":1364},{"class":278,"line":522},[1365],{"type":48,"tag":276,"props":1366,"children":1367},{},[1368],{"type":53,"value":1369},"WHERE client_address LIKE '10.0.1.%'\n",{"type":48,"tag":276,"props":1371,"children":1372},{"class":278,"line":531},[1373],{"type":48,"tag":276,"props":1374,"children":1375},{},[1376],{"type":53,"value":1310},{"type":48,"tag":460,"props":1378,"children":1380},{"id":1379},"combined-filters",[1381],{"type":53,"value":1382},"Combined Filters",{"type":48,"tag":266,"props":1384,"children":1386},{"className":268,"code":1385,"language":21,"meta":270,"style":270},"-- Long queries from specific app and user\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT query_id, node_id, start, now() - start AS running_for,\n       substring(query, 1, 200) AS query_preview\nFROM q\nWHERE application_name = 'payments-api'\n  AND user_name = 'app_user'\n  AND start \u003C now() - INTERVAL '10 minutes'\nORDER BY start;\n",[1387],{"type":48,"tag":62,"props":1388,"children":1389},{"__ignoreMap":270},[1390,1398,1405,1413,1420,1427,1434,1442,1450],{"type":48,"tag":276,"props":1391,"children":1392},{"class":278,"line":279},[1393],{"type":48,"tag":276,"props":1394,"children":1395},{},[1396],{"type":53,"value":1397},"-- Long queries from specific app and user\n",{"type":48,"tag":276,"props":1399,"children":1400},{"class":278,"line":29},[1401],{"type":48,"tag":276,"props":1402,"children":1403},{},[1404],{"type":53,"value":493},{"type":48,"tag":276,"props":1406,"children":1407},{"class":278,"line":25},[1408],{"type":48,"tag":276,"props":1409,"children":1410},{},[1411],{"type":53,"value":1412},"SELECT query_id, node_id, start, now() - start AS running_for,\n",{"type":48,"tag":276,"props":1414,"children":1415},{"class":278,"line":504},[1416],{"type":48,"tag":276,"props":1417,"children":1418},{},[1419],{"type":53,"value":1212},{"type":48,"tag":276,"props":1421,"children":1422},{"class":278,"line":513},[1423],{"type":48,"tag":276,"props":1424,"children":1425},{},[1426],{"type":53,"value":609},{"type":48,"tag":276,"props":1428,"children":1429},{"class":278,"line":522},[1430],{"type":48,"tag":276,"props":1431,"children":1432},{},[1433],{"type":53,"value":1227},{"type":48,"tag":276,"props":1435,"children":1436},{"class":278,"line":531},[1437],{"type":48,"tag":276,"props":1438,"children":1439},{},[1440],{"type":53,"value":1441},"  AND user_name = 'app_user'\n",{"type":48,"tag":276,"props":1443,"children":1444},{"class":278,"line":540},[1445],{"type":48,"tag":276,"props":1446,"children":1447},{},[1448],{"type":53,"value":1449},"  AND start \u003C now() - INTERVAL '10 minutes'\n",{"type":48,"tag":276,"props":1451,"children":1452},{"class":278,"line":549},[1453],{"type":48,"tag":276,"props":1454,"children":1455},{},[1456],{"type":53,"value":1235},{"type":48,"tag":71,"props":1458,"children":1460},{"id":1459},"safety-considerations",[1461],{"type":53,"value":1462},"Safety Considerations",{"type":48,"tag":56,"props":1464,"children":1465},{},[1466,1471,1473,1479,1481,1486],{"type":48,"tag":116,"props":1467,"children":1468},{},[1469],{"type":53,"value":1470},"Read-only operations:",{"type":53,"value":1472},"\nAll diagnostic queries (",{"type":48,"tag":62,"props":1474,"children":1476},{"className":1475},[],[1477],{"type":53,"value":1478},"SHOW",{"type":53,"value":1480}," statements, ",{"type":48,"tag":62,"props":1482,"children":1484},{"className":1483},[],[1485],{"type":53,"value":396},{"type":53,"value":1487},") are read-only and safe to run in production.",{"type":48,"tag":56,"props":1489,"children":1490},{},[1491],{"type":48,"tag":116,"props":1492,"children":1493},{},[1494],{"type":53,"value":1495},"Cancellation operations (opt-in):",{"type":48,"tag":56,"props":1497,"children":1498},{},[1499],{"type":48,"tag":116,"props":1500,"children":1501},{},[1502],{"type":53,"value":1503},"CAUTION: Canceling queries\u002Fsessions terminates user work",{"type":48,"tag":56,"props":1505,"children":1506},{},[1507],{"type":53,"value":1508},"Only proceed if:",{"type":48,"tag":78,"props":1510,"children":1511},{},[1512,1517,1522,1527],{"type":48,"tag":82,"props":1513,"children":1514},{},[1515],{"type":53,"value":1516},"You've confirmed the query\u002Fsession is runaway or stuck",{"type":48,"tag":82,"props":1518,"children":1519},{},[1520],{"type":53,"value":1521},"You have authorization to interrupt user workloads",{"type":48,"tag":82,"props":1523,"children":1524},{},[1525],{"type":53,"value":1526},"You've notified stakeholders if appropriate",{"type":48,"tag":82,"props":1528,"children":1529},{},[1530,1532,1537,1538,1543],{"type":53,"value":1531},"You have ",{"type":48,"tag":62,"props":1533,"children":1535},{"className":1534},[],[1536],{"type":53,"value":246},{"type":53,"value":194},{"type":48,"tag":62,"props":1539,"children":1541},{"className":1540},[],[1542],{"type":53,"value":254},{"type":53,"value":1544}," privileges",{"type":48,"tag":71,"props":1546,"children":1548},{"id":1547},"canceling-runaway-work-opt-in",[1549],{"type":53,"value":1550},"Canceling Runaway Work (Opt-In)",{"type":48,"tag":460,"props":1552,"children":1554},{"id":1553},"cancel-a-specific-query",[1555],{"type":53,"value":1556},"Cancel a Specific Query",{"type":48,"tag":266,"props":1558,"children":1560},{"className":268,"code":1559,"language":21,"meta":270,"style":270},"-- 1. Identify the query_id from triage queries above\n-- 2. Cancel it\nCANCEL QUERY '\u003Cquery_id>';\n",[1561],{"type":48,"tag":62,"props":1562,"children":1563},{"__ignoreMap":270},[1564,1572,1580],{"type":48,"tag":276,"props":1565,"children":1566},{"class":278,"line":279},[1567],{"type":48,"tag":276,"props":1568,"children":1569},{},[1570],{"type":53,"value":1571},"-- 1. Identify the query_id from triage queries above\n",{"type":48,"tag":276,"props":1573,"children":1574},{"class":278,"line":29},[1575],{"type":48,"tag":276,"props":1576,"children":1577},{},[1578],{"type":53,"value":1579},"-- 2. Cancel it\n",{"type":48,"tag":276,"props":1581,"children":1582},{"class":278,"line":25},[1583],{"type":48,"tag":276,"props":1584,"children":1585},{},[1586],{"type":53,"value":1587},"CANCEL QUERY '\u003Cquery_id>';\n",{"type":48,"tag":56,"props":1589,"children":1590},{},[1591],{"type":48,"tag":116,"props":1592,"children":1593},{},[1594],{"type":53,"value":1595},"Example:",{"type":48,"tag":266,"props":1597,"children":1599},{"className":268,"code":1598,"language":21,"meta":270,"style":270},"CANCEL QUERY '15f9e0e91f072f0f0000000000000001';\n",[1600],{"type":48,"tag":62,"props":1601,"children":1602},{"__ignoreMap":270},[1603],{"type":48,"tag":276,"props":1604,"children":1605},{"class":278,"line":279},[1606],{"type":48,"tag":276,"props":1607,"children":1608},{},[1609],{"type":53,"value":1598},{"type":48,"tag":460,"props":1611,"children":1613},{"id":1612},"cancel-an-entire-session",[1614],{"type":53,"value":1615},"Cancel an Entire Session",{"type":48,"tag":266,"props":1617,"children":1619},{"className":268,"code":1618,"language":21,"meta":270,"style":270},"-- 1. Identify the session_id from triage queries above\n-- 2. Cancel all queries in that session\nCANCEL SESSION '\u003Csession_id>';\n",[1620],{"type":48,"tag":62,"props":1621,"children":1622},{"__ignoreMap":270},[1623,1631,1639],{"type":48,"tag":276,"props":1624,"children":1625},{"class":278,"line":279},[1626],{"type":48,"tag":276,"props":1627,"children":1628},{},[1629],{"type":53,"value":1630},"-- 1. Identify the session_id from triage queries above\n",{"type":48,"tag":276,"props":1632,"children":1633},{"class":278,"line":29},[1634],{"type":48,"tag":276,"props":1635,"children":1636},{},[1637],{"type":53,"value":1638},"-- 2. Cancel all queries in that session\n",{"type":48,"tag":276,"props":1640,"children":1641},{"class":278,"line":25},[1642],{"type":48,"tag":276,"props":1643,"children":1644},{},[1645],{"type":53,"value":1646},"CANCEL SESSION '\u003Csession_id>';\n",{"type":48,"tag":56,"props":1648,"children":1649},{},[1650],{"type":48,"tag":116,"props":1651,"children":1652},{},[1653],{"type":53,"value":1595},{"type":48,"tag":266,"props":1655,"children":1657},{"className":268,"code":1656,"language":21,"meta":270,"style":270},"CANCEL SESSION '15f9e0e91f072f0f';\n",[1658],{"type":48,"tag":62,"props":1659,"children":1660},{"__ignoreMap":270},[1661],{"type":48,"tag":276,"props":1662,"children":1663},{"class":278,"line":279},[1664],{"type":48,"tag":276,"props":1665,"children":1666},{},[1667],{"type":53,"value":1656},{"type":48,"tag":56,"props":1669,"children":1670},{},[1671,1676],{"type":48,"tag":116,"props":1672,"children":1673},{},[1674],{"type":53,"value":1675},"Verification:",{"type":53,"value":1677},"\nAfter canceling, re-run the triage queries to confirm the query\u002Fsession is gone.",{"type":48,"tag":56,"props":1679,"children":1680},{},[1681],{"type":48,"tag":116,"props":1682,"children":1683},{},[1684],{"type":53,"value":1685},"Required privileges:",{"type":48,"tag":78,"props":1687,"children":1688},{},[1689,1699,1709],{"type":48,"tag":82,"props":1690,"children":1691},{},[1692,1697],{"type":48,"tag":62,"props":1693,"children":1695},{"className":1694},[],[1696],{"type":53,"value":246},{"type":53,"value":1698}," system privilege to cancel queries",{"type":48,"tag":82,"props":1700,"children":1701},{},[1702,1707],{"type":48,"tag":62,"props":1703,"children":1705},{"className":1704},[],[1706],{"type":53,"value":254},{"type":53,"value":1708}," system privilege to cancel sessions",{"type":48,"tag":82,"props":1710,"children":1711},{},[1712],{"type":53,"value":1713},"Admin role has both by default",{"type":48,"tag":56,"props":1715,"children":1716},{},[1717,1718,1722],{"type":53,"value":289},{"type":48,"tag":124,"props":1719,"children":1720},{"href":292},[1721],{"type":53,"value":295},{"type":53,"value":1723}," for granting these privileges.",{"type":48,"tag":71,"props":1725,"children":1727},{"id":1726},"common-triage-workflows",[1728],{"type":53,"value":1729},"Common Triage Workflows",{"type":48,"tag":460,"props":1731,"children":1733},{"id":1732},"workflow-1-cluster-is-slow-investigation",[1734],{"type":53,"value":1735},"Workflow 1: \"Cluster is slow\" investigation",{"type":48,"tag":56,"props":1737,"children":1738},{},[1739,1744],{"type":48,"tag":116,"props":1740,"children":1741},{},[1742],{"type":53,"value":1743},"Scenario:",{"type":53,"value":1745}," Users report general slowness.",{"type":48,"tag":415,"props":1747,"children":1748},{},[1749,1780,1856,1887],{"type":48,"tag":82,"props":1750,"children":1751},{},[1752,1757],{"type":48,"tag":116,"props":1753,"children":1754},{},[1755],{"type":53,"value":1756},"Check for long-running queries:",{"type":48,"tag":266,"props":1758,"children":1760},{"className":268,"code":1759,"language":21,"meta":270,"style":270},"-- Run the \"Long-Running Queries\" diagnostic\n-- Look for queries running > 5-10 minutes\n",[1761],{"type":48,"tag":62,"props":1762,"children":1763},{"__ignoreMap":270},[1764,1772],{"type":48,"tag":276,"props":1765,"children":1766},{"class":278,"line":279},[1767],{"type":48,"tag":276,"props":1768,"children":1769},{},[1770],{"type":53,"value":1771},"-- Run the \"Long-Running Queries\" diagnostic\n",{"type":48,"tag":276,"props":1773,"children":1774},{"class":278,"line":29},[1775],{"type":48,"tag":276,"props":1776,"children":1777},{},[1778],{"type":53,"value":1779},"-- Look for queries running > 5-10 minutes\n",{"type":48,"tag":82,"props":1781,"children":1782},{},[1783,1788],{"type":48,"tag":116,"props":1784,"children":1785},{},[1786],{"type":53,"value":1787},"Identify source applications:",{"type":48,"tag":266,"props":1789,"children":1791},{"className":268,"code":1790,"language":21,"meta":270,"style":270},"-- Group by application to find culprits\nWITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT application_name, COUNT(*) AS num_queries,\n       AVG(now() - start) AS avg_duration\nFROM q\nWHERE start \u003C now() - INTERVAL '5 minutes'\nGROUP BY application_name\nORDER BY num_queries DESC;\n",[1792],{"type":48,"tag":62,"props":1793,"children":1794},{"__ignoreMap":270},[1795,1803,1810,1818,1826,1833,1840,1848],{"type":48,"tag":276,"props":1796,"children":1797},{"class":278,"line":279},[1798],{"type":48,"tag":276,"props":1799,"children":1800},{},[1801],{"type":53,"value":1802},"-- Group by application to find culprits\n",{"type":48,"tag":276,"props":1804,"children":1805},{"class":278,"line":29},[1806],{"type":48,"tag":276,"props":1807,"children":1808},{},[1809],{"type":53,"value":493},{"type":48,"tag":276,"props":1811,"children":1812},{"class":278,"line":25},[1813],{"type":48,"tag":276,"props":1814,"children":1815},{},[1816],{"type":53,"value":1817},"SELECT application_name, COUNT(*) AS num_queries,\n",{"type":48,"tag":276,"props":1819,"children":1820},{"class":278,"line":504},[1821],{"type":48,"tag":276,"props":1822,"children":1823},{},[1824],{"type":53,"value":1825},"       AVG(now() - start) AS avg_duration\n",{"type":48,"tag":276,"props":1827,"children":1828},{"class":278,"line":513},[1829],{"type":48,"tag":276,"props":1830,"children":1831},{},[1832],{"type":53,"value":609},{"type":48,"tag":276,"props":1834,"children":1835},{"class":278,"line":522},[1836],{"type":48,"tag":276,"props":1837,"children":1838},{},[1839],{"type":53,"value":618},{"type":48,"tag":276,"props":1841,"children":1842},{"class":278,"line":531},[1843],{"type":48,"tag":276,"props":1844,"children":1845},{},[1846],{"type":53,"value":1847},"GROUP BY application_name\n",{"type":48,"tag":276,"props":1849,"children":1850},{"class":278,"line":540},[1851],{"type":48,"tag":276,"props":1852,"children":1853},{},[1854],{"type":53,"value":1855},"ORDER BY num_queries DESC;\n",{"type":48,"tag":82,"props":1857,"children":1858},{},[1859,1864],{"type":48,"tag":116,"props":1860,"children":1861},{},[1862],{"type":53,"value":1863},"Drill down into specific app:",{"type":48,"tag":266,"props":1865,"children":1867},{"className":268,"code":1866,"language":21,"meta":270,"style":270},"-- Filter by top application from step 2\n-- Use \"Filter by Application\" query\n",[1868],{"type":48,"tag":62,"props":1869,"children":1870},{"__ignoreMap":270},[1871,1879],{"type":48,"tag":276,"props":1872,"children":1873},{"class":278,"line":279},[1874],{"type":48,"tag":276,"props":1875,"children":1876},{},[1877],{"type":53,"value":1878},"-- Filter by top application from step 2\n",{"type":48,"tag":276,"props":1880,"children":1881},{"class":278,"line":29},[1882],{"type":48,"tag":276,"props":1883,"children":1884},{},[1885],{"type":53,"value":1886},"-- Use \"Filter by Application\" query\n",{"type":48,"tag":82,"props":1888,"children":1889},{},[1890,1895],{"type":48,"tag":116,"props":1891,"children":1892},{},[1893],{"type":53,"value":1894},"Decide on action:",{"type":48,"tag":78,"props":1896,"children":1897},{},[1898,1903,1908],{"type":48,"tag":82,"props":1899,"children":1900},{},[1901],{"type":53,"value":1902},"Contact app team to investigate query patterns",{"type":48,"tag":82,"props":1904,"children":1905},{},[1906],{"type":53,"value":1907},"Cancel specific runaway queries if critical",{"type":48,"tag":82,"props":1909,"children":1910},{},[1911],{"type":53,"value":1912},"Check for schema\u002Findex issues if queries are legitimate",{"type":48,"tag":460,"props":1914,"children":1916},{"id":1915},"workflow-2-find-high-retry-transactions",[1917],{"type":53,"value":1918},"Workflow 2: Find high-retry transactions",{"type":48,"tag":56,"props":1920,"children":1921},{},[1922,1926],{"type":48,"tag":116,"props":1923,"children":1924},{},[1925],{"type":53,"value":1743},{"type":53,"value":1927}," Suspect contention issues.",{"type":48,"tag":415,"props":1929,"children":1930},{},[1931,1999,2061],{"type":48,"tag":82,"props":1932,"children":1933},{},[1934,1939],{"type":48,"tag":116,"props":1935,"children":1936},{},[1937],{"type":53,"value":1938},"Check for high retry counts:",{"type":48,"tag":266,"props":1940,"children":1942},{"className":268,"code":1941,"language":21,"meta":270,"style":270},"SELECT application_name, AVG(num_retries) AS avg_retries,\n       MAX(num_retries) AS max_retries, COUNT(*) AS num_txns\nFROM crdb_internal.cluster_transactions\nWHERE start \u003C now() - INTERVAL '5 minutes'\nGROUP BY application_name\nHAVING AVG(num_retries) > 5\nORDER BY avg_retries DESC;\n",[1943],{"type":48,"tag":62,"props":1944,"children":1945},{"__ignoreMap":270},[1946,1954,1962,1969,1976,1983,1991],{"type":48,"tag":276,"props":1947,"children":1948},{"class":278,"line":279},[1949],{"type":48,"tag":276,"props":1950,"children":1951},{},[1952],{"type":53,"value":1953},"SELECT application_name, AVG(num_retries) AS avg_retries,\n",{"type":48,"tag":276,"props":1955,"children":1956},{"class":278,"line":29},[1957],{"type":48,"tag":276,"props":1958,"children":1959},{},[1960],{"type":53,"value":1961},"       MAX(num_retries) AS max_retries, COUNT(*) AS num_txns\n",{"type":48,"tag":276,"props":1963,"children":1964},{"class":278,"line":25},[1965],{"type":48,"tag":276,"props":1966,"children":1967},{},[1968],{"type":53,"value":1069},{"type":48,"tag":276,"props":1970,"children":1971},{"class":278,"line":504},[1972],{"type":48,"tag":276,"props":1973,"children":1974},{},[1975],{"type":53,"value":618},{"type":48,"tag":276,"props":1977,"children":1978},{"class":278,"line":513},[1979],{"type":48,"tag":276,"props":1980,"children":1981},{},[1982],{"type":53,"value":1847},{"type":48,"tag":276,"props":1984,"children":1985},{"class":278,"line":522},[1986],{"type":48,"tag":276,"props":1987,"children":1988},{},[1989],{"type":53,"value":1990},"HAVING AVG(num_retries) > 5\n",{"type":48,"tag":276,"props":1992,"children":1993},{"class":278,"line":531},[1994],{"type":48,"tag":276,"props":1995,"children":1996},{},[1997],{"type":53,"value":1998},"ORDER BY avg_retries DESC;\n",{"type":48,"tag":82,"props":2000,"children":2001},{},[2002,2007],{"type":48,"tag":116,"props":2003,"children":2004},{},[2005],{"type":53,"value":2006},"Investigate specific transactions:",{"type":48,"tag":266,"props":2008,"children":2010},{"className":268,"code":2009,"language":21,"meta":270,"style":270},"-- Find transactions with >10 retries\nSELECT id, application_name, num_retries, num_stmts,\n       substring(txn_string, 1, 200) AS txn_preview\nFROM crdb_internal.cluster_transactions\nWHERE num_retries > 10\nORDER BY num_retries DESC;\n",[2011],{"type":48,"tag":62,"props":2012,"children":2013},{"__ignoreMap":270},[2014,2022,2030,2038,2045,2053],{"type":48,"tag":276,"props":2015,"children":2016},{"class":278,"line":279},[2017],{"type":48,"tag":276,"props":2018,"children":2019},{},[2020],{"type":53,"value":2021},"-- Find transactions with >10 retries\n",{"type":48,"tag":276,"props":2023,"children":2024},{"class":278,"line":29},[2025],{"type":48,"tag":276,"props":2026,"children":2027},{},[2028],{"type":53,"value":2029},"SELECT id, application_name, num_retries, num_stmts,\n",{"type":48,"tag":276,"props":2031,"children":2032},{"class":278,"line":25},[2033],{"type":48,"tag":276,"props":2034,"children":2035},{},[2036],{"type":53,"value":2037},"       substring(txn_string, 1, 200) AS txn_preview\n",{"type":48,"tag":276,"props":2039,"children":2040},{"class":278,"line":504},[2041],{"type":48,"tag":276,"props":2042,"children":2043},{},[2044],{"type":53,"value":1069},{"type":48,"tag":276,"props":2046,"children":2047},{"class":278,"line":513},[2048],{"type":48,"tag":276,"props":2049,"children":2050},{},[2051],{"type":53,"value":2052},"WHERE num_retries > 10\n",{"type":48,"tag":276,"props":2054,"children":2055},{"class":278,"line":522},[2056],{"type":48,"tag":276,"props":2057,"children":2058},{},[2059],{"type":53,"value":2060},"ORDER BY num_retries DESC;\n",{"type":48,"tag":82,"props":2062,"children":2063},{},[2064,2069],{"type":48,"tag":116,"props":2065,"children":2066},{},[2067],{"type":53,"value":2068},"Next steps:",{"type":48,"tag":78,"props":2070,"children":2071},{},[2072,2077,2082],{"type":48,"tag":82,"props":2073,"children":2074},{},[2075],{"type":53,"value":2076},"Review transaction patterns for contention",{"type":48,"tag":82,"props":2078,"children":2079},{},[2080],{"type":53,"value":2081},"Check for lock conflicts or hotspots",{"type":48,"tag":82,"props":2083,"children":2084},{},[2085],{"type":53,"value":2086},"Consider schema changes to reduce contention",{"type":48,"tag":460,"props":2088,"children":2090},{"id":2089},"workflow-3-identify-resource-hogs-by-user",[2091],{"type":53,"value":2092},"Workflow 3: Identify resource hogs by user",{"type":48,"tag":56,"props":2094,"children":2095},{},[2096,2100],{"type":48,"tag":116,"props":2097,"children":2098},{},[2099],{"type":53,"value":1743},{"type":53,"value":2101}," Need to attribute load to specific users.",{"type":48,"tag":415,"props":2103,"children":2104},{},[2105,2165,2187],{"type":48,"tag":82,"props":2106,"children":2107},{},[2108,2113],{"type":48,"tag":116,"props":2109,"children":2110},{},[2111],{"type":53,"value":2112},"Count active queries per user:",{"type":48,"tag":266,"props":2114,"children":2116},{"className":268,"code":2115,"language":21,"meta":270,"style":270},"WITH q AS (SHOW CLUSTER STATEMENTS)\nSELECT user_name, COUNT(*) AS num_active_queries,\n       AVG(now() - start) AS avg_duration\nFROM q\nGROUP BY user_name\nORDER BY num_active_queries DESC;\n",[2117],{"type":48,"tag":62,"props":2118,"children":2119},{"__ignoreMap":270},[2120,2127,2135,2142,2149,2157],{"type":48,"tag":276,"props":2121,"children":2122},{"class":278,"line":279},[2123],{"type":48,"tag":276,"props":2124,"children":2125},{},[2126],{"type":53,"value":493},{"type":48,"tag":276,"props":2128,"children":2129},{"class":278,"line":29},[2130],{"type":48,"tag":276,"props":2131,"children":2132},{},[2133],{"type":53,"value":2134},"SELECT user_name, COUNT(*) AS num_active_queries,\n",{"type":48,"tag":276,"props":2136,"children":2137},{"class":278,"line":25},[2138],{"type":48,"tag":276,"props":2139,"children":2140},{},[2141],{"type":53,"value":1825},{"type":48,"tag":276,"props":2143,"children":2144},{"class":278,"line":504},[2145],{"type":48,"tag":276,"props":2146,"children":2147},{},[2148],{"type":53,"value":609},{"type":48,"tag":276,"props":2150,"children":2151},{"class":278,"line":513},[2152],{"type":48,"tag":276,"props":2153,"children":2154},{},[2155],{"type":53,"value":2156},"GROUP BY user_name\n",{"type":48,"tag":276,"props":2158,"children":2159},{"class":278,"line":522},[2160],{"type":48,"tag":276,"props":2161,"children":2162},{},[2163],{"type":53,"value":2164},"ORDER BY num_active_queries DESC;\n",{"type":48,"tag":82,"props":2166,"children":2167},{},[2168,2173],{"type":48,"tag":116,"props":2169,"children":2170},{},[2171],{"type":53,"value":2172},"Drill down to specific user's activity:",{"type":48,"tag":266,"props":2174,"children":2176},{"className":268,"code":2175,"language":21,"meta":270,"style":270},"-- Use \"Filter by User\" query\n",[2177],{"type":48,"tag":62,"props":2178,"children":2179},{"__ignoreMap":270},[2180],{"type":48,"tag":276,"props":2181,"children":2182},{"class":278,"line":279},[2183],{"type":48,"tag":276,"props":2184,"children":2185},{},[2186],{"type":53,"value":2175},{"type":48,"tag":82,"props":2188,"children":2189},{},[2190,2195],{"type":48,"tag":116,"props":2191,"children":2192},{},[2193],{"type":53,"value":2194},"Take action:",{"type":48,"tag":78,"props":2196,"children":2197},{},[2198,2203,2208],{"type":48,"tag":82,"props":2199,"children":2200},{},[2201],{"type":53,"value":2202},"Contact user if unexpected load",{"type":48,"tag":82,"props":2204,"children":2205},{},[2206],{"type":53,"value":2207},"Review user's query patterns",{"type":48,"tag":82,"props":2209,"children":2210},{},[2211],{"type":53,"value":2212},"Cancel if clearly runaway",{"type":48,"tag":71,"props":2214,"children":2216},{"id":2215},"troubleshooting",[2217],{"type":53,"value":2218},"Troubleshooting",{"type":48,"tag":310,"props":2220,"children":2221},{},[2222,2243],{"type":48,"tag":314,"props":2223,"children":2224},{},[2225],{"type":48,"tag":318,"props":2226,"children":2227},{},[2228,2233,2238],{"type":48,"tag":322,"props":2229,"children":2230},{},[2231],{"type":53,"value":2232},"Issue",{"type":48,"tag":322,"props":2234,"children":2235},{},[2236],{"type":53,"value":2237},"Cause",{"type":48,"tag":322,"props":2239,"children":2240},{},[2241],{"type":53,"value":2242},"Fix",{"type":48,"tag":338,"props":2244,"children":2245},{},[2246,2282,2320,2350,2373,2391],{"type":48,"tag":318,"props":2247,"children":2248},{},[2249,2259,2264],{"type":48,"tag":345,"props":2250,"children":2251},{},[2252,2257],{"type":48,"tag":62,"props":2253,"children":2255},{"className":2254},[],[2256],{"type":53,"value":353},{"type":53,"value":2258}," returns empty",{"type":48,"tag":345,"props":2260,"children":2261},{},[2262],{"type":53,"value":2263},"No active queries, or insufficient privileges",{"type":48,"tag":345,"props":2265,"children":2266},{},[2267,2269,2274,2275,2280],{"type":53,"value":2268},"Grant ",{"type":48,"tag":62,"props":2270,"children":2272},{"className":2271},[],[2273],{"type":53,"value":192},{"type":53,"value":194},{"type":48,"tag":62,"props":2276,"children":2278},{"className":2277},[],[2279],{"type":53,"value":200},{"type":53,"value":2281},"; verify cluster has active load",{"type":48,"tag":318,"props":2283,"children":2284},{},[2285,2296,2308],{"type":48,"tag":345,"props":2286,"children":2287},{},[2288,2290],{"type":53,"value":2289},"Query text shows ",{"type":48,"tag":62,"props":2291,"children":2293},{"className":2292},[],[2294],{"type":53,"value":2295},"\u003Chidden>",{"type":48,"tag":345,"props":2297,"children":2298},{},[2299,2301,2306],{"type":53,"value":2300},"Using ",{"type":48,"tag":62,"props":2302,"children":2304},{"className":2303},[],[2305],{"type":53,"value":200},{"type":53,"value":2307}," privilege",{"type":48,"tag":345,"props":2309,"children":2310},{},[2311,2313,2318],{"type":53,"value":2312},"This is expected for privacy; use ",{"type":48,"tag":62,"props":2314,"children":2316},{"className":2315},[],[2317],{"type":53,"value":192},{"type":53,"value":2319}," if full text needed",{"type":48,"tag":318,"props":2321,"children":2322},{},[2323,2328,2339],{"type":48,"tag":345,"props":2324,"children":2325},{},[2326],{"type":53,"value":2327},"Can't cancel query: \"permission denied\"",{"type":48,"tag":345,"props":2329,"children":2330},{},[2331,2333,2338],{"type":53,"value":2332},"Missing ",{"type":48,"tag":62,"props":2334,"children":2336},{"className":2335},[],[2337],{"type":53,"value":246},{"type":53,"value":2307},{"type":48,"tag":345,"props":2340,"children":2341},{},[2342,2343,2348],{"type":53,"value":2268},{"type":48,"tag":62,"props":2344,"children":2346},{"className":2345},[],[2347],{"type":53,"value":246},{"type":53,"value":2349}," system privilege to your user",{"type":48,"tag":318,"props":2351,"children":2352},{},[2353,2363,2368],{"type":48,"tag":345,"props":2354,"children":2355},{},[2356,2361],{"type":48,"tag":62,"props":2357,"children":2359},{"className":2358},[],[2360],{"type":53,"value":396},{"type":53,"value":2362}," slow",{"type":48,"tag":345,"props":2364,"children":2365},{},[2366],{"type":53,"value":2367},"High transaction volume on cluster",{"type":48,"tag":345,"props":2369,"children":2370},{},[2371],{"type":53,"value":2372},"Add filters (application_name, time threshold) to reduce result set",{"type":48,"tag":318,"props":2374,"children":2375},{},[2376,2381,2386],{"type":48,"tag":345,"props":2377,"children":2378},{},[2379],{"type":53,"value":2380},"\"relation does not exist\" error",{"type":48,"tag":345,"props":2382,"children":2383},{},[2384],{"type":53,"value":2385},"Typo in table name or old CockroachDB version",{"type":48,"tag":345,"props":2387,"children":2388},{},[2389],{"type":53,"value":2390},"Verify you're using production-approved tables; check CockroachDB version compatibility",{"type":48,"tag":318,"props":2392,"children":2393},{},[2394,2399,2404],{"type":48,"tag":345,"props":2395,"children":2396},{},[2397],{"type":53,"value":2398},"Triage queries themselves are slow",{"type":48,"tag":345,"props":2400,"children":2401},{},[2402],{"type":53,"value":2403},"Cluster under extreme load",{"type":48,"tag":345,"props":2405,"children":2406},{},[2407],{"type":53,"value":2408},"Use more aggressive filters (shorter time window, specific apps); consider canceling obvious runaway work first",{"type":48,"tag":71,"props":2410,"children":2412},{"id":2411},"key-considerations",[2413],{"type":53,"value":2414},"Key Considerations",{"type":48,"tag":78,"props":2416,"children":2417},{},[2418,2441,2451,2468,2486,2496,2506],{"type":48,"tag":82,"props":2419,"children":2420},{},[2421,2426,2427,2432,2434,2439],{"type":48,"tag":116,"props":2422,"children":2423},{},[2424],{"type":53,"value":2425},"Privacy:",{"type":53,"value":122},{"type":48,"tag":62,"props":2428,"children":2430},{"className":2429},[],[2431],{"type":53,"value":200},{"type":53,"value":2433}," instead of ",{"type":48,"tag":62,"props":2435,"children":2437},{"className":2436},[],[2438],{"type":53,"value":192},{"type":53,"value":2440}," to protect sensitive query constants in multi-tenant environments",{"type":48,"tag":82,"props":2442,"children":2443},{},[2444,2449],{"type":48,"tag":116,"props":2445,"children":2446},{},[2447],{"type":53,"value":2448},"Performance impact:",{"type":53,"value":2450}," Triage queries are read-only and lightweight, but avoid running them in tight loops during extreme load",{"type":48,"tag":82,"props":2452,"children":2453},{},[2454,2459,2461,2466],{"type":48,"tag":116,"props":2455,"children":2456},{},[2457],{"type":53,"value":2458},"LIMIT clause:",{"type":53,"value":2460}," Always include ",{"type":48,"tag":62,"props":2462,"children":2464},{"className":2463},[],[2465],{"type":53,"value":742},{"type":53,"value":2467}," to prevent overwhelming output on large clusters",{"type":48,"tag":82,"props":2469,"children":2470},{},[2471,2476,2478,2484],{"type":48,"tag":116,"props":2472,"children":2473},{},[2474],{"type":53,"value":2475},"Time thresholds:",{"type":53,"value":2477}," Adjust ",{"type":48,"tag":62,"props":2479,"children":2481},{"className":2480},[],[2482],{"type":53,"value":2483},"INTERVAL",{"type":53,"value":2485}," based on your workload (5 minutes is a reasonable default, but fast OLTP may need 30 seconds)",{"type":48,"tag":82,"props":2487,"children":2488},{},[2489,2494],{"type":48,"tag":116,"props":2490,"children":2491},{},[2492],{"type":53,"value":2493},"Cancellation is disruptive:",{"type":53,"value":2495}," Only cancel queries\u002Fsessions after confirming they're problematic; coordinate with application teams when possible",{"type":48,"tag":82,"props":2497,"children":2498},{},[2499,2504],{"type":48,"tag":116,"props":2500,"children":2501},{},[2502],{"type":53,"value":2503},"Not for historical analysis:",{"type":53,"value":2505}," These queries show current state only; for trends over time, use DB Console or Prometheus metrics",{"type":48,"tag":82,"props":2507,"children":2508},{},[2509,2514,2516,2521,2522,2527,2529,2534],{"type":48,"tag":116,"props":2510,"children":2511},{},[2512],{"type":53,"value":2513},"Production-approved sources:",{"type":53,"value":2515}," Only use ",{"type":48,"tag":62,"props":2517,"children":2519},{"className":2518},[],[2520],{"type":53,"value":353},{"type":53,"value":723},{"type":48,"tag":62,"props":2523,"children":2525},{"className":2524},[],[2526],{"type":53,"value":375},{"type":53,"value":2528},", and ",{"type":48,"tag":62,"props":2530,"children":2532},{"className":2531},[],[2533],{"type":53,"value":396},{"type":53,"value":2535}," for production triage",{"type":48,"tag":71,"props":2537,"children":2539},{"id":2538},"references",[2540],{"type":53,"value":2541},"References",{"type":48,"tag":56,"props":2543,"children":2544},{},[2545],{"type":48,"tag":116,"props":2546,"children":2547},{},[2548],{"type":53,"value":2549},"Skill references:",{"type":48,"tag":78,"props":2551,"children":2552},{},[2553,2562],{"type":48,"tag":82,"props":2554,"children":2555},{},[2556],{"type":48,"tag":124,"props":2557,"children":2559},{"href":2558},"references\u002Fsql-queries.md",[2560],{"type":53,"value":2561},"SQL query variations and examples",{"type":48,"tag":82,"props":2563,"children":2564},{},[2565],{"type":48,"tag":124,"props":2566,"children":2567},{"href":292},[2568],{"type":53,"value":2569},"RBAC and privilege setup",{"type":48,"tag":56,"props":2571,"children":2572},{},[2573],{"type":48,"tag":116,"props":2574,"children":2575},{},[2576],{"type":53,"value":2577},"Related skills:",{"type":48,"tag":78,"props":2579,"children":2580},{},[2581,2590],{"type":48,"tag":82,"props":2582,"children":2583},{},[2584,2588],{"type":48,"tag":124,"props":2585,"children":2586},{"href":126},[2587],{"type":53,"value":129},{"type":53,"value":2589}," - For historical performance pattern analysis and trend identification",{"type":48,"tag":82,"props":2591,"children":2592},{},[2593,2597],{"type":48,"tag":124,"props":2594,"children":2595},{"href":140},[2596],{"type":53,"value":143},{"type":53,"value":2598}," - For historical transaction-level analysis including retry storms and commit latency",{"type":48,"tag":56,"props":2600,"children":2601},{},[2602],{"type":48,"tag":116,"props":2603,"children":2604},{},[2605],{"type":53,"value":2606},"Official CockroachDB Documentation:",{"type":48,"tag":78,"props":2608,"children":2609},{},[2610,2621,2631,2641,2651,2660],{"type":48,"tag":82,"props":2611,"children":2612},{},[2613],{"type":48,"tag":124,"props":2614,"children":2618},{"href":2615,"rel":2616},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fshow-statements.html",[2617],"nofollow",[2619],{"type":53,"value":2620},"SHOW STATEMENTS",{"type":48,"tag":82,"props":2622,"children":2623},{},[2624],{"type":48,"tag":124,"props":2625,"children":2628},{"href":2626,"rel":2627},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fshow-sessions.html",[2617],[2629],{"type":53,"value":2630},"SHOW SESSIONS",{"type":48,"tag":82,"props":2632,"children":2633},{},[2634],{"type":48,"tag":124,"props":2635,"children":2638},{"href":2636,"rel":2637},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcancel-query.html",[2617],[2639],{"type":53,"value":2640},"CANCEL QUERY",{"type":48,"tag":82,"props":2642,"children":2643},{},[2644],{"type":48,"tag":124,"props":2645,"children":2648},{"href":2646,"rel":2647},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcancel-session.html",[2617],[2649],{"type":53,"value":2650},"CANCEL SESSION",{"type":48,"tag":82,"props":2652,"children":2653},{},[2654],{"type":48,"tag":124,"props":2655,"children":2658},{"href":2656,"rel":2657},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcrdb-internal.html",[2617],[2659],{"type":53,"value":67},{"type":48,"tag":82,"props":2661,"children":2662},{},[2663],{"type":48,"tag":124,"props":2664,"children":2667},{"href":2665,"rel":2666},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fsecurity-reference\u002Fauthorization.html#supported-privileges",[2617],[2668],{"type":53,"value":2669},"VIEWACTIVITY privilege",{"type":48,"tag":2671,"props":2672,"children":2673},"style",{},[2674],{"type":53,"value":2675},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2677,"total":2769},[2678,2690,2703,2720,2733,2746,2759],{"slug":2679,"name":2679,"fn":2680,"description":2681,"org":2682,"tags":2683,"stars":25,"repoUrl":26,"updatedAt":2689},"analyzing-range-distribution","analyze CockroachDB range distribution and health","Analyzes CockroachDB range distribution across tables and indexes using SHOW RANGES to identify range count, size patterns, leaseholder placement, and replication health. Use when investigating hotspots, uneven data distribution, range fragmentation, or validating zone configuration effects without DB Console access.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2684,2685,2688],{"name":17,"slug":18,"type":15},{"name":2686,"slug":2687,"type":15},"Monitoring","monitoring",{"name":13,"slug":14,"type":15},"2026-07-12T07:57:18.753533",{"slug":2691,"name":2691,"fn":2692,"description":2693,"org":2694,"tags":2695,"stars":25,"repoUrl":26,"updatedAt":2702},"analyzing-schema-change-storage-risk","analyze schema change storage requirements","Estimates storage requirements for CockroachDB online schema change backfills using SHOW RANGES WITH DETAILS, KEYS, INDEXES. Use before CREATE INDEX, ADD COLUMN with INDEX\u002FUNIQUE, ALTER PRIMARY KEY, CREATE MATERIALIZED VIEW, CREATE TABLE AS, REFRESH, or SET LOCALITY on tables with large per-index footprints, to avoid mid-backfill disk exhaustion.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2696,2699,2700,2701],{"name":2697,"slug":2698,"type":15},"Data Modeling","data-modeling",{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},"2026-07-12T07:57:22.763788",{"slug":2704,"name":2704,"fn":2705,"description":2706,"org":2707,"tags":2708,"stars":25,"repoUrl":26,"updatedAt":2719},"auditing-cis-benchmark","audit CockroachDB clusters against CIS benchmarks","Audits a self-hosted CockroachDB cluster against the CIS CockroachDB Benchmark v1.0.0 Level 1 controls. Supports two audit depths — quick automated scans and full CIS audit procedures. Produces a structured PASS\u002FFAIL\u002FMANUAL report covering installation, system hardening, logging, user access, data protection, and CockroachDB settings. Use when preparing for CIS compliance assessments, hardening self-hosted deployments, or validating security posture against industry benchmarks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2709,2712,2715,2716],{"name":2710,"slug":2711,"type":15},"Audit","audit",{"name":2713,"slug":2714,"type":15},"Compliance","compliance",{"name":17,"slug":18,"type":15},{"name":2717,"slug":2718,"type":15},"Security","security","2026-07-18T05:48:00.862384",{"slug":2721,"name":2721,"fn":2722,"description":2723,"org":2724,"tags":2725,"stars":25,"repoUrl":26,"updatedAt":2732},"auditing-cloud-cluster-security","audit CockroachDB cluster security posture","Audits the security posture of a CockroachDB cluster (Cloud or self-hosted) across network, authentication, authorization, encryption, audit logging, and backup dimensions. Use when assessing cluster security readiness, preparing for compliance reviews, or investigating security configuration gaps.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2726,2727,2728,2731],{"name":2710,"slug":2711,"type":15},{"name":17,"slug":18,"type":15},{"name":2729,"slug":2730,"type":15},"Operations","operations",{"name":2717,"slug":2718,"type":15},"2026-07-12T07:57:01.506735",{"slug":2734,"name":2734,"fn":2735,"description":2736,"org":2737,"tags":2738,"stars":25,"repoUrl":26,"updatedAt":2745},"auditing-table-statistics","audit optimizer table statistics","Audits optimizer table statistics for staleness, missing coverage, and data quality issues using SHOW STATISTICS. Use when diagnosing poor query performance, unexpected plan changes, or after bulk data changes to identify stale statistics requiring refresh via CREATE STATISTICS.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2739,2740,2743,2744],{"name":2710,"slug":2711,"type":15},{"name":2741,"slug":2742,"type":15},"Data Analysis","data-analysis",{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},"2026-07-12T07:57:16.190081",{"slug":2747,"name":2747,"fn":2748,"description":2749,"org":2750,"tags":2751,"stars":25,"repoUrl":26,"updatedAt":2758},"benchmarking-transaction-patterns","benchmark CockroachDB transaction patterns","Guides benchmarking and comparing explicit multi-statement transactions versus single-statement CTE transactions in CockroachDB, with fair test methodology, contention analysis, and performance interpretation. Use when comparing transaction formulations, benchmarking CockroachDB workloads under contention, investigating retry pressure, or deciding whether to rewrite multi-step application flows into single SQL statements.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2752,2753,2756,2757],{"name":17,"slug":18,"type":15},{"name":2754,"slug":2755,"type":15},"Engineering","engineering",{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},"2026-07-12T07:57:26.543278",{"slug":2760,"name":2760,"fn":2761,"description":2762,"org":2763,"tags":2764,"stars":25,"repoUrl":26,"updatedAt":2768},"cockroachdb-sql","write and optimize CockroachDB SQL","Use when writing, generating, or optimizing SQL for CockroachDB, designing CockroachDB schemas, or when the user asks about CockroachDB-specific SQL patterns, type mappings, and distributed database best practices. Also use when encountering CockroachDB anti-patterns like missing primary keys, sequential ID hotspots, or incorrect type usage.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2765,2766,2767],{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},"2026-07-25T05:31:22.562808",34,{"items":2771,"total":2889},[2772,2789,2803,2816,2827,2837,2848,2854,2861,2868,2875,2882],{"slug":2773,"name":2773,"fn":2774,"description":2775,"org":2776,"tags":2777,"stars":2786,"repoUrl":2787,"updatedAt":2788},"collecting-cockroachdb-operator-escalation-packet","collect CockroachDB operator escalation packets","Collects a complete CockroachDB Operator escalation packet for TSC\u002FTSE or operator-team handoff, including Helm state, Kubernetes resources, logs, operation-specific evidence, pprof goroutine dumps, metrics, and a customer action timeline. Use when general diagnosis cannot resolve an operator-managed CockroachDB Helm issue or before restarting a stuck operator.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2778,2779,2782,2785],{"name":17,"slug":18,"type":15},{"name":2780,"slug":2781,"type":15},"Incident Response","incident-response",{"name":2783,"slug":2784,"type":15},"Kubernetes","kubernetes",{"name":2686,"slug":2687,"type":15},105,"https:\u002F\u002Fgithub.com\u002Fcockroachdb\u002Fhelm-charts","2026-07-12T07:57:25.288146",{"slug":2790,"name":2790,"fn":2791,"description":2792,"org":2793,"tags":2794,"stars":2786,"repoUrl":2787,"updatedAt":2802},"configuring-cockroachdb-helm-tls","configure TLS for CockroachDB Helm charts","Selects and validates TLS settings for CockroachDB Helm chart deployments, including self-signer, cert-manager, and external certificate modes. Use when a customer needs secure CockroachDB Helm values, certificate secret mapping, cert-manager integration, or TLS install troubleshooting before deploying the chart.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2795,2798,2801],{"name":2796,"slug":2797,"type":15},"Deployment","deployment",{"name":2799,"slug":2800,"type":15},"Encryption","encryption",{"name":2717,"slug":2718,"type":15},"2026-07-12T07:56:37.675396",{"slug":2804,"name":2804,"fn":2805,"description":2806,"org":2807,"tags":2808,"stars":2786,"repoUrl":2787,"updatedAt":2815},"debugging-cockroachdb-operator-migrations","debug CockroachDB Operator migration scenarios","Debugs CockroachDB Operator migration scenarios, including Helm StatefulSet to v1beta1 CrdbNode migration and public operator v1alpha1 to v1beta1 migration. Use when migration labels, migration phases, source StatefulSet ownership, converted CRDs, PVC ownership, or post-migration reconciliation are unclear or stuck.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2809,2810,2811,2812],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":2783,"slug":2784,"type":15},{"name":2813,"slug":2814,"type":15},"Migration","migration","2026-07-12T07:56:48.360871",{"slug":2817,"name":2817,"fn":2818,"description":2819,"org":2820,"tags":2821,"stars":2786,"repoUrl":2787,"updatedAt":2826},"diagnosing-cockroachdb-helm-deployments","diagnose CockroachDB Helm chart deployments","Diagnoses failed or unhealthy CockroachDB Helm chart deployments by checking Helm release state, operator health, CrdbCluster and CrdbNode status, pod readiness, RBAC, webhooks, TLS, upgrades, scaling, PVCs, DNS, and multi-region assumptions. Use when Helm install or upgrade fails, pods are not Ready, or the operator is not reconciling.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2822,2823,2824,2825],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":2796,"slug":2797,"type":15},{"name":2783,"slug":2784,"type":15},"2026-07-12T07:57:24.018818",{"slug":2828,"name":2828,"fn":2829,"description":2830,"org":2831,"tags":2832,"stars":2786,"repoUrl":2787,"updatedAt":2836},"installing-cockroachdb-with-helm","install CockroachDB using Helm","Guides customer-facing installation of CockroachDB on Kubernetes using the CockroachDB split Helm charts and operator-managed v1beta1 resources. Use when installing CockroachDB with Helm, choosing between published and local split charts, verifying a new install, or helping an agent complete first-time Kubernetes onboarding.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2833,2834,2835],{"name":17,"slug":18,"type":15},{"name":2796,"slug":2797,"type":15},{"name":2783,"slug":2784,"type":15},"2026-07-12T07:56:45.777567",{"slug":2838,"name":2838,"fn":2839,"description":2840,"org":2841,"tags":2842,"stars":2786,"repoUrl":2787,"updatedAt":2847},"validating-cockroachdb-helm-multiregion","validate CockroachDB multi-region Helm deployments","Validates CockroachDB Helm chart values and Kubernetes prerequisites for operator-managed multi-region deployments. Use before adding a region, deploying CockroachDB across multiple Kubernetes clusters, checking region DNS domains, or confirming that all regions share certificate and networking assumptions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2843,2844,2845,2846],{"name":17,"slug":18,"type":15},{"name":2796,"slug":2797,"type":15},{"name":2783,"slug":2784,"type":15},{"name":2729,"slug":2730,"type":15},"2026-07-12T07:56:47.082609",{"slug":2679,"name":2679,"fn":2680,"description":2681,"org":2849,"tags":2850,"stars":25,"repoUrl":26,"updatedAt":2689},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2851,2852,2853],{"name":17,"slug":18,"type":15},{"name":2686,"slug":2687,"type":15},{"name":13,"slug":14,"type":15},{"slug":2691,"name":2691,"fn":2692,"description":2693,"org":2855,"tags":2856,"stars":25,"repoUrl":26,"updatedAt":2702},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2857,2858,2859,2860],{"name":2697,"slug":2698,"type":15},{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},{"slug":2704,"name":2704,"fn":2705,"description":2706,"org":2862,"tags":2863,"stars":25,"repoUrl":26,"updatedAt":2719},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2864,2865,2866,2867],{"name":2710,"slug":2711,"type":15},{"name":2713,"slug":2714,"type":15},{"name":17,"slug":18,"type":15},{"name":2717,"slug":2718,"type":15},{"slug":2721,"name":2721,"fn":2722,"description":2723,"org":2869,"tags":2870,"stars":25,"repoUrl":26,"updatedAt":2732},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2871,2872,2873,2874],{"name":2710,"slug":2711,"type":15},{"name":17,"slug":18,"type":15},{"name":2729,"slug":2730,"type":15},{"name":2717,"slug":2718,"type":15},{"slug":2734,"name":2734,"fn":2735,"description":2736,"org":2876,"tags":2877,"stars":25,"repoUrl":26,"updatedAt":2745},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2878,2879,2880,2881],{"name":2710,"slug":2711,"type":15},{"name":2741,"slug":2742,"type":15},{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"slug":2747,"name":2747,"fn":2748,"description":2749,"org":2883,"tags":2884,"stars":25,"repoUrl":26,"updatedAt":2758},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2885,2886,2887,2888],{"name":17,"slug":18,"type":15},{"name":2754,"slug":2755,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},40]