[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-cockroachdb-profiling-statement-fingerprints":3,"mdc--kshxi0-key":39,"related-repo-cockroachdb-profiling-statement-fingerprints":2512,"related-org-cockroachdb-profiling-statement-fingerprints":2606},{"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},"profiling-statement-fingerprints","profile SQL statement fingerprints","Ranks and analyzes statement fingerprints using aggregated SQL statistics from crdb_internal.statement_statistics to identify slow, resource-intensive, or error-prone query patterns. Use when investigating historical performance trends, identifying optimization opportunities, or diagnosing recurring slowness 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:20.111728",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\u002Fprofiling-statement-fingerprints","---\nname: profiling-statement-fingerprints\ndescription: Ranks and analyzes statement fingerprints using aggregated SQL statistics from crdb_internal.statement_statistics to identify slow, resource-intensive, or error-prone query patterns. Use when investigating historical performance trends, identifying optimization opportunities, or diagnosing recurring slowness without DB Console access.\ncompatibility: Requires SQL access with VIEWACTIVITY or VIEWACTIVITYREDACTED cluster privilege. Uses crdb_internal.statement_statistics (production-safe). Execution statistics fields are sampled and may be sparse.\nmetadata:\n  author: cockroachdb\n  version: \"1.0\"\n---\n\n# Profiling Statement Fingerprints\n\nAnalyzes historical statement performance patterns using aggregated SQL statistics to identify slow, resource-intensive, or error-prone query fingerprints. Uses `crdb_internal.statement_statistics` for time-windowed analysis of latency, CPU, contention, admission delays, and failure rates - entirely via SQL without requiring DB Console access.\n\n**Complement to triaging-live-sql-activity:** This skill analyzes historical patterns; for immediate triage of currently running queries, see [triaging-live-sql-activity](..\u002Ftriaging-live-sql-activity\u002FSKILL.md).\n\n## When to Use This Skill\n\n- Identify slowest statement fingerprints over past hours\u002Fdays\u002Fweeks\n- Find queries with high CPU consumption, contention, or admission waits\n- Investigate performance regressions or plan changes\n- Locate full table scans or missing indexes via index recommendations\n- Analyze resource consumption by application or database\n- SQL-only historical analysis without DB Console access\n\n**For immediate incident response:** Use [triaging-live-sql-activity](..\u002Ftriaging-live-sql-activity\u002FSKILL.md) to triage currently running queries and cancel runaway work.\n**For transaction-level analysis:** Use [profiling-transaction-fingerprints](..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md) to analyze retry patterns, commit latency, and statement composition at the transaction boundary.\n**For background job monitoring:** Use [monitoring-background-jobs](..\u002Fmonitoring-background-jobs\u002FSKILL.md) for long-running schema changes and automatic jobs excluded from statement statistics.\n\n## Prerequisites\n\n- SQL connection to CockroachDB cluster\n- `VIEWACTIVITY` or `VIEWACTIVITYREDACTED` cluster privilege for cluster-wide visibility\n- Statement statistics collection enabled (default): `sql.stats.automatic_collection.enabled = true`\n\n**Check collection status:**\n```sql\nSHOW CLUSTER SETTING sql.stats.automatic_collection.enabled;  -- Should return: true\n```\n\nSee [triaging-live-sql-activity permissions reference](..\u002Ftriaging-live-sql-activity\u002Freferences\u002Fpermissions.md) for RBAC setup (same privileges).\n\n## Core Concepts\n\n### Statement Fingerprints vs Live Queries\n\n**Statement fingerprint:** Normalized SQL pattern with parameterized constants (e.g., `SELECT * FROM users WHERE id = $1` vs `SELECT * FROM users WHERE id = 123`)\n\n**Key differences:**\n- **Time scope:** Historical hourly buckets vs real-time current state\n- **Granularity:** Aggregated pattern statistics vs individual execution instances\n\n### Time-Series Bucketing\n\n**aggregated_ts:** Hourly UTC buckets (e.g., `2026-02-21 14:00:00` = 14:00-14:59 executions)\n**Data retention:** Capped by row count, not time. `sql.stats.persisted_rows.max` (default 1,000,000) bounds the persisted statement+transaction rows; older buckets are compacted once the cap is reached. Effective wall-clock window depends on workload diversity.\n**Best practice:** Always filter by time window: `WHERE aggregated_ts > now() - INTERVAL '24 hours'`\n\n### Aggregated vs Sampled Metrics\n\n| Metric Category | JSON Path | Scope | Use Case |\n|-----------------|-----------|-------|----------|\n| **Aggregated** | `statistics.statistics.*` | All executions | Latency, row counts, execution counts |\n| **Sampled** | `statistics.execution_statistics.*` | Probabilistic sample governed by `sql.txn_stats.sample_rate` (default 0.01) | CPU, contention, admission wait, memory\u002Fdisk |\n\n**Critical:** Always check sampled metrics presence: `WHERE (statistics->'execution_statistics'->>'cnt') IS NOT NULL`\n\n### JSON Field Extraction\n\n**Operators:**\n- `->`: Extract JSON object (returns JSON)\n- `->>`: Extract as text (returns text)\n- `::TYPE`: Cast to specific type\n\n**Examples:**\n```sql\nmetadata->>'db'                                              -- Database name\n(statistics->'statistics'->>'cnt')::INT                      -- Execution count\n(statistics->'statistics'->'runLat'->>'mean')::FLOAT8        -- Mean latency (seconds)\n(statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9  -- CPU (convert nanos to seconds)\n```\n\n**Units:** Latency = seconds, CPU\u002Fadmission = nanoseconds (÷ 1e9), Memory\u002Fdisk = bytes (÷ 1048576 for MB)\n\nSee [JSON field reference](references\u002Fjson-field-reference.md) for complete schema.\n\n## Core Diagnostic Queries\n\n### Query 1: Top Statements by Mean Run Latency\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 AS mean_run_lat_seconds,\n  (statistics->'statistics'->'runLat'->>'max')::FLOAT8 AS max_run_lat_seconds,\n  (metadata->>'fullScan')::BOOL AS full_scan,\n  metadata->'index_recommendations' AS index_recommendations,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 > 1.0  -- > 1 second mean latency\nORDER BY (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n```\n\n**Focus:** Slowest queries; check `full_scan` and `index_recommendations` for optimization opportunities.\n\n### Query 2: Admission Control Impact\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_admission_wait_seconds,\n  (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 AS mean_run_lat_seconds,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 > 0\nORDER BY (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n```\n\n**Interpretation:** High admission wait = cluster at resource limits (CPU, memory, I\u002FO). Ratio > 1.0 (wait > runtime) indicates severe queueing.\n\n### Query 3: Plan Hash Diversity\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  COUNT(DISTINCT plan_hash) AS distinct_plan_count,\n  array_agg(DISTINCT plan_hash ORDER BY plan_hash) AS plan_hashes,\n  SUM((statistics->'statistics'->>'cnt')::INT) AS total_executions\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '7 days'\nGROUP BY fingerprint_id, metadata->>'db', metadata->>'query'\nHAVING COUNT(DISTINCT plan_hash) > 1\nORDER BY COUNT(DISTINCT plan_hash) DESC, SUM((statistics->'statistics'->>'cnt')::INT) DESC\nLIMIT 20;\n```\n\n**Interpretation:** Multiple plans indicate instability from schema changes, statistics updates, or routing changes. Performance can vary significantly between plans.\n\n### Query 4: High Contention Statements\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'app' AS application,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_contention_seconds,\n  ROUND(\n    ((statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9) \u002F\n    NULLIF((statistics->'statistics'->'runLat'->>'mean')::FLOAT8, 0) * 100, 2\n  ) AS contention_pct_of_runtime,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 > 0\nORDER BY (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n```\n\n**Interpretation:** >20% contention = transaction conflicts, hot row access. Remediate with batching, transaction boundary changes, or schema redesign.\n\n### Query 5: High CPU Consumers\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9 AS mean_cpu_seconds,\n  (statistics->'statistics'->>'cnt')::INT AS total_executions,\n  ROUND(\n    ((statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9) *\n    (statistics->'statistics'->>'cnt')::INT, 2\n  ) AS estimated_total_cpu_seconds,\n  (metadata->>'fullScan')::BOOL AS full_scan,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 > 0\nORDER BY estimated_total_cpu_seconds DESC\nLIMIT 20;\n```\n\n**Focus:** `estimated_total_cpu_seconds` shows cluster impact. High mean CPU often correlates with `full_scan = true`.\n\n### Query 6: Memory and Disk Spill Detection\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'execution_statistics'->'maxMemUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_mem_mb,\n  (statistics->'execution_statistics'->'maxMemUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_mem_mb,\n  (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_disk_mb,\n  (statistics->'execution_statistics'->'maxDiskUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_disk_mb,\n  metadata->>'stmtType' AS statement_type,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 > 0  -- Has disk spills\nORDER BY (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n```\n\n**Interpretation:** Disk usage > 0 = memory spill (~100-1000x slower than in-memory). Common for large aggregations, sorts, hash joins. Fix with indexes or increased `sql.distsql.temp_storage.workmem`.\n\n### Query 7: Error-Prone Statements\n\n```sql\nSELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'statistics'->>'cnt')::INT AS total_executions,\n  COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) AS failure_count,\n  ROUND(\n    COALESCE((statistics->'statistics'->>'failureCount')::INT, 0)::NUMERIC \u002F\n    NULLIF((statistics->'statistics'->>'cnt')::INT, 0) * 100, 2\n  ) AS failure_rate_pct,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'statistics'->>'cnt')::INT > 10\n  AND COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) > 0\nORDER BY failure_rate_pct DESC, failure_count DESC\nLIMIT 20;\n```\n\n**Common causes:** Constraint violations, query timeouts, transaction retry errors (40001), permission denied.\n\n## Common Workflows\n\n### Workflow 1: Slowness Investigation\n\n1. **Identify slow fingerprints:** Run Query 1 with 24h window, focus on `mean_run_lat_seconds > 5` and high execution counts\n2. **Check for full scans:** Filter `full_scan = true`, review `index_recommendations`\n3. **Correlate to applications:** Group by `metadata->>'app'`, contact teams with specific patterns\n4. **Cross-reference live activity:** If ongoing, use triaging-live-sql-activity to cancel runaway queries\n\n### Workflow 2: Contention Analysis\n\n1. **Find high-contention statements:** Run Query 4, focus on `contention_pct_of_runtime > 20%`\n2. **Check plan stability:** Run Query 3 for contending fingerprints (plan changes affect lock order)\n3. **Remediate:** Batch operations, use `SELECT FOR UPDATE`, partition hot tables, denormalize schema\n\n### Workflow 3: Admission Control Debugging\n\n1. **Identify admission waits:** Run Query 2, calculate wait ratio\n2. **Correlate with CPU:** Run Query 5 for same window, cross-reference fingerprint IDs\n3. **Analyze time patterns:** Group by `aggregated_ts` to find peak periods\n4. **Triage:** Short-term: spread batch jobs; Long-term: add capacity, optimize queries\n\n### Workflow 4: Memory Spill Investigation\n\n1. **Find spilling statements:** Run Query 6, focus on `max_disk_mb > 100`\n2. **Analyze patterns:** Identify large `GROUP BY`, `ORDER BY`, hash joins\n3. **Remediate:** Add indexes, increase workmem (with caution), rewrite queries, use materialized views\n\n## Safety Considerations\n\n**Read-only operations:** All queries are `SELECT` statements against production-approved `crdb_internal.statement_statistics`.\n\n**Performance impact:**\n\n| Consideration | Impact | Mitigation |\n|---------------|--------|------------|\n| Large table | Many rows with high statement diversity | Always use time filters and `LIMIT` |\n| JSON parsing | CPU overhead | Use specific time windows, avoid tight loops |\n| Broad windows | 7-day queries = more rows | Default to 24h; expand only when needed |\n\n**Privacy:** Use `VIEWACTIVITYREDACTED` to redact query constants in multi-tenant environments.\n\n## Troubleshooting\n\n| Issue | Cause | Fix |\n|-------|-------|-----|\n| Empty results | No data or stats collection disabled | Check `sql.stats.automatic_collection.enabled = true` |\n| `column does not exist` | JSON field typo or version mismatch | Verify field names; check CockroachDB version |\n| NULL in sampled metrics | Metric not sampled in bucket | Filter: `WHERE (statistics->'execution_statistics'->>'cnt') IS NOT NULL` |\n| Query text shows `\u003Chidden>` | Using VIEWACTIVITYREDACTED | Expected; use VIEWACTIVITY if authorized |\n| \"invalid input syntax for type json\" | Malformed JSON path | Check operators: `->` for JSON, `->>` for text |\n| Very slow query | Large table, no time filter | Always add time window and LIMIT |\n| Empty `index_recommendations` | No recommendations or optimal | Normal if indexes exist |\n\n## Key Considerations\n\n- **Time windows:** Default to 24h; expand to 7d for trends\n- **Sampled metrics:** Not all executions captured; check sample size (`cnt`)\n- **JSON safety:** Use defensive NULL checks; handle type casting errors\n- **Privacy:** Use VIEWACTIVITYREDACTED in production\n- **Performance:** Always include time filters and LIMIT\n- **Complement to live triage:** Use together for complete coverage (historical + real-time)\n- **Data retention:** Bounded by the row-count cap `sql.stats.persisted_rows.max` (default 1,000,000), not a TTL; effective time window varies with workload diversity\n- **Plan instability:** Multiple plan hashes indicate optimizer\u002Fschema changes\n\n## References\n\n**Skill references:**\n- [JSON field schema and extraction](references\u002Fjson-field-reference.md)\n- [Metrics catalog and units](references\u002Fmetrics-and-units.md)\n- [SQL query variations](references\u002Fsql-query-variations.md)\n- [RBAC and privileges](..\u002Ftriaging-live-sql-activity\u002Freferences\u002Fpermissions.md) (shared with triaging-live-sql-activity)\n\n**Official CockroachDB Documentation:**\n- [crdb_internal](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcrdb-internal.html)\n- [Statements Page (DB Console)](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fui-statements-page.html)\n- [Monitor and Analyze Transaction Contention](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fmonitor-and-analyze-transaction-contention.html)\n- [VIEWACTIVITY privilege](https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fsecurity-reference\u002Fauthorization.html#supported-privileges)\n\n**Related skills:**\n- [triaging-live-sql-activity](..\u002Ftriaging-live-sql-activity\u002FSKILL.md) - For immediate triage of currently running queries\n- [profiling-transaction-fingerprints](..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md) - For transaction-level analysis including retry patterns and commit latency\n",{"data":40,"body":44},{"name":4,"description":6,"compatibility":41,"metadata":42},"Requires SQL access with VIEWACTIVITY or VIEWACTIVITYREDACTED cluster privilege. Uses crdb_internal.statement_statistics (production-safe). Execution statistics fields are sampled and may be sparse.",{"author":8,"version":43},"1.0",{"type":45,"children":46},"root",[47,55,70,90,97,132,176,182,220,228,248,261,267,274,300,308,331,337,383,389,495,511,517,525,561,569,609,619,631,637,643,781,807,813,922,932,938,1043,1052,1058,1203,1212,1218,1358,1382,1388,1514,1530,1536,1669,1679,1685,1691,1763,1769,1816,1822,1872,1878,1932,1938,1962,1970,2057,2073,2079,2271,2277,2372,2378,2386,2425,2433,2477,2485,2506],{"type":48,"tag":49,"props":50,"children":51},"element","h1",{"id":4},[52],{"type":53,"value":54},"text","Profiling Statement Fingerprints",{"type":48,"tag":56,"props":57,"children":58},"p",{},[59,61,68],{"type":53,"value":60},"Analyzes historical statement performance patterns using aggregated SQL statistics to identify slow, resource-intensive, or error-prone query fingerprints. Uses ",{"type":48,"tag":62,"props":63,"children":65},"code",{"className":64},[],[66],{"type":53,"value":67},"crdb_internal.statement_statistics",{"type":53,"value":69}," for time-windowed analysis of latency, CPU, contention, admission delays, and failure rates - entirely via SQL without requiring DB Console access.",{"type":48,"tag":56,"props":71,"children":72},{},[73,79,81,88],{"type":48,"tag":74,"props":75,"children":76},"strong",{},[77],{"type":53,"value":78},"Complement to triaging-live-sql-activity:",{"type":53,"value":80}," This skill analyzes historical patterns; for immediate triage of currently running queries, see ",{"type":48,"tag":82,"props":83,"children":85},"a",{"href":84},"..\u002Ftriaging-live-sql-activity\u002FSKILL.md",[86],{"type":53,"value":87},"triaging-live-sql-activity",{"type":53,"value":89},".",{"type":48,"tag":91,"props":92,"children":94},"h2",{"id":93},"when-to-use-this-skill",[95],{"type":53,"value":96},"When to Use This Skill",{"type":48,"tag":98,"props":99,"children":100},"ul",{},[101,107,112,117,122,127],{"type":48,"tag":102,"props":103,"children":104},"li",{},[105],{"type":53,"value":106},"Identify slowest statement fingerprints over past hours\u002Fdays\u002Fweeks",{"type":48,"tag":102,"props":108,"children":109},{},[110],{"type":53,"value":111},"Find queries with high CPU consumption, contention, or admission waits",{"type":48,"tag":102,"props":113,"children":114},{},[115],{"type":53,"value":116},"Investigate performance regressions or plan changes",{"type":48,"tag":102,"props":118,"children":119},{},[120],{"type":53,"value":121},"Locate full table scans or missing indexes via index recommendations",{"type":48,"tag":102,"props":123,"children":124},{},[125],{"type":53,"value":126},"Analyze resource consumption by application or database",{"type":48,"tag":102,"props":128,"children":129},{},[130],{"type":53,"value":131},"SQL-only historical analysis without DB Console access",{"type":48,"tag":56,"props":133,"children":134},{},[135,140,142,146,148,153,154,160,162,167,168,174],{"type":48,"tag":74,"props":136,"children":137},{},[138],{"type":53,"value":139},"For immediate incident response:",{"type":53,"value":141}," Use ",{"type":48,"tag":82,"props":143,"children":144},{"href":84},[145],{"type":53,"value":87},{"type":53,"value":147}," to triage currently running queries and cancel runaway work.\n",{"type":48,"tag":74,"props":149,"children":150},{},[151],{"type":53,"value":152},"For transaction-level analysis:",{"type":53,"value":141},{"type":48,"tag":82,"props":155,"children":157},{"href":156},"..\u002Fprofiling-transaction-fingerprints\u002FSKILL.md",[158],{"type":53,"value":159},"profiling-transaction-fingerprints",{"type":53,"value":161}," to analyze retry patterns, commit latency, and statement composition at the transaction boundary.\n",{"type":48,"tag":74,"props":163,"children":164},{},[165],{"type":53,"value":166},"For background job monitoring:",{"type":53,"value":141},{"type":48,"tag":82,"props":169,"children":171},{"href":170},"..\u002Fmonitoring-background-jobs\u002FSKILL.md",[172],{"type":53,"value":173},"monitoring-background-jobs",{"type":53,"value":175}," for long-running schema changes and automatic jobs excluded from statement statistics.",{"type":48,"tag":91,"props":177,"children":179},{"id":178},"prerequisites",[180],{"type":53,"value":181},"Prerequisites",{"type":48,"tag":98,"props":183,"children":184},{},[185,190,209],{"type":48,"tag":102,"props":186,"children":187},{},[188],{"type":53,"value":189},"SQL connection to CockroachDB cluster",{"type":48,"tag":102,"props":191,"children":192},{},[193,199,201,207],{"type":48,"tag":62,"props":194,"children":196},{"className":195},[],[197],{"type":53,"value":198},"VIEWACTIVITY",{"type":53,"value":200}," or ",{"type":48,"tag":62,"props":202,"children":204},{"className":203},[],[205],{"type":53,"value":206},"VIEWACTIVITYREDACTED",{"type":53,"value":208}," cluster privilege for cluster-wide visibility",{"type":48,"tag":102,"props":210,"children":211},{},[212,214],{"type":53,"value":213},"Statement statistics collection enabled (default): ",{"type":48,"tag":62,"props":215,"children":217},{"className":216},[],[218],{"type":53,"value":219},"sql.stats.automatic_collection.enabled = true",{"type":48,"tag":56,"props":221,"children":222},{},[223],{"type":48,"tag":74,"props":224,"children":225},{},[226],{"type":53,"value":227},"Check collection status:",{"type":48,"tag":229,"props":230,"children":234},"pre",{"className":231,"code":232,"language":21,"meta":233,"style":233},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","SHOW CLUSTER SETTING sql.stats.automatic_collection.enabled;  -- Should return: true\n","",[235],{"type":48,"tag":62,"props":236,"children":237},{"__ignoreMap":233},[238],{"type":48,"tag":239,"props":240,"children":243},"span",{"class":241,"line":242},"line",1,[244],{"type":48,"tag":239,"props":245,"children":246},{},[247],{"type":53,"value":232},{"type":48,"tag":56,"props":249,"children":250},{},[251,253,259],{"type":53,"value":252},"See ",{"type":48,"tag":82,"props":254,"children":256},{"href":255},"..\u002Ftriaging-live-sql-activity\u002Freferences\u002Fpermissions.md",[257],{"type":53,"value":258},"triaging-live-sql-activity permissions reference",{"type":53,"value":260}," for RBAC setup (same privileges).",{"type":48,"tag":91,"props":262,"children":264},{"id":263},"core-concepts",[265],{"type":53,"value":266},"Core Concepts",{"type":48,"tag":268,"props":269,"children":271},"h3",{"id":270},"statement-fingerprints-vs-live-queries",[272],{"type":53,"value":273},"Statement Fingerprints vs Live Queries",{"type":48,"tag":56,"props":275,"children":276},{},[277,282,284,290,292,298],{"type":48,"tag":74,"props":278,"children":279},{},[280],{"type":53,"value":281},"Statement fingerprint:",{"type":53,"value":283}," Normalized SQL pattern with parameterized constants (e.g., ",{"type":48,"tag":62,"props":285,"children":287},{"className":286},[],[288],{"type":53,"value":289},"SELECT * FROM users WHERE id = $1",{"type":53,"value":291}," vs ",{"type":48,"tag":62,"props":293,"children":295},{"className":294},[],[296],{"type":53,"value":297},"SELECT * FROM users WHERE id = 123",{"type":53,"value":299},")",{"type":48,"tag":56,"props":301,"children":302},{},[303],{"type":48,"tag":74,"props":304,"children":305},{},[306],{"type":53,"value":307},"Key differences:",{"type":48,"tag":98,"props":309,"children":310},{},[311,321],{"type":48,"tag":102,"props":312,"children":313},{},[314,319],{"type":48,"tag":74,"props":315,"children":316},{},[317],{"type":53,"value":318},"Time scope:",{"type":53,"value":320}," Historical hourly buckets vs real-time current state",{"type":48,"tag":102,"props":322,"children":323},{},[324,329],{"type":48,"tag":74,"props":325,"children":326},{},[327],{"type":53,"value":328},"Granularity:",{"type":53,"value":330}," Aggregated pattern statistics vs individual execution instances",{"type":48,"tag":268,"props":332,"children":334},{"id":333},"time-series-bucketing",[335],{"type":53,"value":336},"Time-Series Bucketing",{"type":48,"tag":56,"props":338,"children":339},{},[340,345,347,353,355,360,362,368,370,375,377],{"type":48,"tag":74,"props":341,"children":342},{},[343],{"type":53,"value":344},"aggregated_ts:",{"type":53,"value":346}," Hourly UTC buckets (e.g., ",{"type":48,"tag":62,"props":348,"children":350},{"className":349},[],[351],{"type":53,"value":352},"2026-02-21 14:00:00",{"type":53,"value":354}," = 14:00-14:59 executions)\n",{"type":48,"tag":74,"props":356,"children":357},{},[358],{"type":53,"value":359},"Data retention:",{"type":53,"value":361}," Capped by row count, not time. ",{"type":48,"tag":62,"props":363,"children":365},{"className":364},[],[366],{"type":53,"value":367},"sql.stats.persisted_rows.max",{"type":53,"value":369}," (default 1,000,000) bounds the persisted statement+transaction rows; older buckets are compacted once the cap is reached. Effective wall-clock window depends on workload diversity.\n",{"type":48,"tag":74,"props":371,"children":372},{},[373],{"type":53,"value":374},"Best practice:",{"type":53,"value":376}," Always filter by time window: ",{"type":48,"tag":62,"props":378,"children":380},{"className":379},[],[381],{"type":53,"value":382},"WHERE aggregated_ts > now() - INTERVAL '24 hours'",{"type":48,"tag":268,"props":384,"children":386},{"id":385},"aggregated-vs-sampled-metrics",[387],{"type":53,"value":388},"Aggregated vs Sampled Metrics",{"type":48,"tag":390,"props":391,"children":392},"table",{},[393,422],{"type":48,"tag":394,"props":395,"children":396},"thead",{},[397],{"type":48,"tag":398,"props":399,"children":400},"tr",{},[401,407,412,417],{"type":48,"tag":402,"props":403,"children":404},"th",{},[405],{"type":53,"value":406},"Metric Category",{"type":48,"tag":402,"props":408,"children":409},{},[410],{"type":53,"value":411},"JSON Path",{"type":48,"tag":402,"props":413,"children":414},{},[415],{"type":53,"value":416},"Scope",{"type":48,"tag":402,"props":418,"children":419},{},[420],{"type":53,"value":421},"Use Case",{"type":48,"tag":423,"props":424,"children":425},"tbody",{},[426,457],{"type":48,"tag":398,"props":427,"children":428},{},[429,438,447,452],{"type":48,"tag":430,"props":431,"children":432},"td",{},[433],{"type":48,"tag":74,"props":434,"children":435},{},[436],{"type":53,"value":437},"Aggregated",{"type":48,"tag":430,"props":439,"children":440},{},[441],{"type":48,"tag":62,"props":442,"children":444},{"className":443},[],[445],{"type":53,"value":446},"statistics.statistics.*",{"type":48,"tag":430,"props":448,"children":449},{},[450],{"type":53,"value":451},"All executions",{"type":48,"tag":430,"props":453,"children":454},{},[455],{"type":53,"value":456},"Latency, row counts, execution counts",{"type":48,"tag":398,"props":458,"children":459},{},[460,468,477,490],{"type":48,"tag":430,"props":461,"children":462},{},[463],{"type":48,"tag":74,"props":464,"children":465},{},[466],{"type":53,"value":467},"Sampled",{"type":48,"tag":430,"props":469,"children":470},{},[471],{"type":48,"tag":62,"props":472,"children":474},{"className":473},[],[475],{"type":53,"value":476},"statistics.execution_statistics.*",{"type":48,"tag":430,"props":478,"children":479},{},[480,482,488],{"type":53,"value":481},"Probabilistic sample governed by ",{"type":48,"tag":62,"props":483,"children":485},{"className":484},[],[486],{"type":53,"value":487},"sql.txn_stats.sample_rate",{"type":53,"value":489}," (default 0.01)",{"type":48,"tag":430,"props":491,"children":492},{},[493],{"type":53,"value":494},"CPU, contention, admission wait, memory\u002Fdisk",{"type":48,"tag":56,"props":496,"children":497},{},[498,503,505],{"type":48,"tag":74,"props":499,"children":500},{},[501],{"type":53,"value":502},"Critical:",{"type":53,"value":504}," Always check sampled metrics presence: ",{"type":48,"tag":62,"props":506,"children":508},{"className":507},[],[509],{"type":53,"value":510},"WHERE (statistics->'execution_statistics'->>'cnt') IS NOT NULL",{"type":48,"tag":268,"props":512,"children":514},{"id":513},"json-field-extraction",[515],{"type":53,"value":516},"JSON Field Extraction",{"type":48,"tag":56,"props":518,"children":519},{},[520],{"type":48,"tag":74,"props":521,"children":522},{},[523],{"type":53,"value":524},"Operators:",{"type":48,"tag":98,"props":526,"children":527},{},[528,539,550],{"type":48,"tag":102,"props":529,"children":530},{},[531,537],{"type":48,"tag":62,"props":532,"children":534},{"className":533},[],[535],{"type":53,"value":536},"->",{"type":53,"value":538},": Extract JSON object (returns JSON)",{"type":48,"tag":102,"props":540,"children":541},{},[542,548],{"type":48,"tag":62,"props":543,"children":545},{"className":544},[],[546],{"type":53,"value":547},"->>",{"type":53,"value":549},": Extract as text (returns text)",{"type":48,"tag":102,"props":551,"children":552},{},[553,559],{"type":48,"tag":62,"props":554,"children":556},{"className":555},[],[557],{"type":53,"value":558},"::TYPE",{"type":53,"value":560},": Cast to specific type",{"type":48,"tag":56,"props":562,"children":563},{},[564],{"type":48,"tag":74,"props":565,"children":566},{},[567],{"type":53,"value":568},"Examples:",{"type":48,"tag":229,"props":570,"children":572},{"className":231,"code":571,"language":21,"meta":233,"style":233},"metadata->>'db'                                              -- Database name\n(statistics->'statistics'->>'cnt')::INT                      -- Execution count\n(statistics->'statistics'->'runLat'->>'mean')::FLOAT8        -- Mean latency (seconds)\n(statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9  -- CPU (convert nanos to seconds)\n",[573],{"type":48,"tag":62,"props":574,"children":575},{"__ignoreMap":233},[576,584,592,600],{"type":48,"tag":239,"props":577,"children":578},{"class":241,"line":242},[579],{"type":48,"tag":239,"props":580,"children":581},{},[582],{"type":53,"value":583},"metadata->>'db'                                              -- Database name\n",{"type":48,"tag":239,"props":585,"children":586},{"class":241,"line":29},[587],{"type":48,"tag":239,"props":588,"children":589},{},[590],{"type":53,"value":591},"(statistics->'statistics'->>'cnt')::INT                      -- Execution count\n",{"type":48,"tag":239,"props":593,"children":594},{"class":241,"line":25},[595],{"type":48,"tag":239,"props":596,"children":597},{},[598],{"type":53,"value":599},"(statistics->'statistics'->'runLat'->>'mean')::FLOAT8        -- Mean latency (seconds)\n",{"type":48,"tag":239,"props":601,"children":603},{"class":241,"line":602},4,[604],{"type":48,"tag":239,"props":605,"children":606},{},[607],{"type":53,"value":608},"(statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9  -- CPU (convert nanos to seconds)\n",{"type":48,"tag":56,"props":610,"children":611},{},[612,617],{"type":48,"tag":74,"props":613,"children":614},{},[615],{"type":53,"value":616},"Units:",{"type":53,"value":618}," Latency = seconds, CPU\u002Fadmission = nanoseconds (÷ 1e9), Memory\u002Fdisk = bytes (÷ 1048576 for MB)",{"type":48,"tag":56,"props":620,"children":621},{},[622,623,629],{"type":53,"value":252},{"type":48,"tag":82,"props":624,"children":626},{"href":625},"references\u002Fjson-field-reference.md",[627],{"type":53,"value":628},"JSON field reference",{"type":53,"value":630}," for complete schema.",{"type":48,"tag":91,"props":632,"children":634},{"id":633},"core-diagnostic-queries",[635],{"type":53,"value":636},"Core Diagnostic Queries",{"type":48,"tag":268,"props":638,"children":640},{"id":639},"query-1-top-statements-by-mean-run-latency",[641],{"type":53,"value":642},"Query 1: Top Statements by Mean Run Latency",{"type":48,"tag":229,"props":644,"children":646},{"className":231,"code":645,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 AS mean_run_lat_seconds,\n  (statistics->'statistics'->'runLat'->>'max')::FLOAT8 AS max_run_lat_seconds,\n  (metadata->>'fullScan')::BOOL AS full_scan,\n  metadata->'index_recommendations' AS index_recommendations,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 > 1.0  -- > 1 second mean latency\nORDER BY (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n",[647],{"type":48,"tag":62,"props":648,"children":649},{"__ignoreMap":233},[650,658,666,674,682,691,700,709,718,727,736,745,754,763,772],{"type":48,"tag":239,"props":651,"children":652},{"class":241,"line":242},[653],{"type":48,"tag":239,"props":654,"children":655},{},[656],{"type":53,"value":657},"SELECT\n",{"type":48,"tag":239,"props":659,"children":660},{"class":241,"line":29},[661],{"type":48,"tag":239,"props":662,"children":663},{},[664],{"type":53,"value":665},"  fingerprint_id,\n",{"type":48,"tag":239,"props":667,"children":668},{"class":241,"line":25},[669],{"type":48,"tag":239,"props":670,"children":671},{},[672],{"type":53,"value":673},"  metadata->>'db' AS database,\n",{"type":48,"tag":239,"props":675,"children":676},{"class":241,"line":602},[677],{"type":48,"tag":239,"props":678,"children":679},{},[680],{"type":53,"value":681},"  metadata->>'query' AS query_text,\n",{"type":48,"tag":239,"props":683,"children":685},{"class":241,"line":684},5,[686],{"type":48,"tag":239,"props":687,"children":688},{},[689],{"type":53,"value":690},"  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n",{"type":48,"tag":239,"props":692,"children":694},{"class":241,"line":693},6,[695],{"type":48,"tag":239,"props":696,"children":697},{},[698],{"type":53,"value":699},"  (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 AS mean_run_lat_seconds,\n",{"type":48,"tag":239,"props":701,"children":703},{"class":241,"line":702},7,[704],{"type":48,"tag":239,"props":705,"children":706},{},[707],{"type":53,"value":708},"  (statistics->'statistics'->'runLat'->>'max')::FLOAT8 AS max_run_lat_seconds,\n",{"type":48,"tag":239,"props":710,"children":712},{"class":241,"line":711},8,[713],{"type":48,"tag":239,"props":714,"children":715},{},[716],{"type":53,"value":717},"  (metadata->>'fullScan')::BOOL AS full_scan,\n",{"type":48,"tag":239,"props":719,"children":721},{"class":241,"line":720},9,[722],{"type":48,"tag":239,"props":723,"children":724},{},[725],{"type":53,"value":726},"  metadata->'index_recommendations' AS index_recommendations,\n",{"type":48,"tag":239,"props":728,"children":730},{"class":241,"line":729},10,[731],{"type":48,"tag":239,"props":732,"children":733},{},[734],{"type":53,"value":735},"  aggregated_ts\n",{"type":48,"tag":239,"props":737,"children":739},{"class":241,"line":738},11,[740],{"type":48,"tag":239,"props":741,"children":742},{},[743],{"type":53,"value":744},"FROM crdb_internal.statement_statistics\n",{"type":48,"tag":239,"props":746,"children":748},{"class":241,"line":747},12,[749],{"type":48,"tag":239,"props":750,"children":751},{},[752],{"type":53,"value":753},"WHERE aggregated_ts > now() - INTERVAL '24 hours'\n",{"type":48,"tag":239,"props":755,"children":757},{"class":241,"line":756},13,[758],{"type":48,"tag":239,"props":759,"children":760},{},[761],{"type":53,"value":762},"  AND (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 > 1.0  -- > 1 second mean latency\n",{"type":48,"tag":239,"props":764,"children":766},{"class":241,"line":765},14,[767],{"type":48,"tag":239,"props":768,"children":769},{},[770],{"type":53,"value":771},"ORDER BY (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 DESC\n",{"type":48,"tag":239,"props":773,"children":775},{"class":241,"line":774},15,[776],{"type":48,"tag":239,"props":777,"children":778},{},[779],{"type":53,"value":780},"LIMIT 20;\n",{"type":48,"tag":56,"props":782,"children":783},{},[784,789,791,797,799,805],{"type":48,"tag":74,"props":785,"children":786},{},[787],{"type":53,"value":788},"Focus:",{"type":53,"value":790}," Slowest queries; check ",{"type":48,"tag":62,"props":792,"children":794},{"className":793},[],[795],{"type":53,"value":796},"full_scan",{"type":53,"value":798}," and ",{"type":48,"tag":62,"props":800,"children":802},{"className":801},[],[803],{"type":53,"value":804},"index_recommendations",{"type":53,"value":806}," for optimization opportunities.",{"type":48,"tag":268,"props":808,"children":810},{"id":809},"query-2-admission-control-impact",[811],{"type":53,"value":812},"Query 2: Admission Control Impact",{"type":48,"tag":229,"props":814,"children":816},{"className":231,"code":815,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_admission_wait_seconds,\n  (statistics->'statistics'->'runLat'->>'mean')::FLOAT8 AS mean_run_lat_seconds,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 > 0\nORDER BY (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n",[817],{"type":48,"tag":62,"props":818,"children":819},{"__ignoreMap":233},[820,827,834,841,848,855,863,870,877,884,891,899,907,915],{"type":48,"tag":239,"props":821,"children":822},{"class":241,"line":242},[823],{"type":48,"tag":239,"props":824,"children":825},{},[826],{"type":53,"value":657},{"type":48,"tag":239,"props":828,"children":829},{"class":241,"line":29},[830],{"type":48,"tag":239,"props":831,"children":832},{},[833],{"type":53,"value":665},{"type":48,"tag":239,"props":835,"children":836},{"class":241,"line":25},[837],{"type":48,"tag":239,"props":838,"children":839},{},[840],{"type":53,"value":673},{"type":48,"tag":239,"props":842,"children":843},{"class":241,"line":602},[844],{"type":48,"tag":239,"props":845,"children":846},{},[847],{"type":53,"value":681},{"type":48,"tag":239,"props":849,"children":850},{"class":241,"line":684},[851],{"type":48,"tag":239,"props":852,"children":853},{},[854],{"type":53,"value":690},{"type":48,"tag":239,"props":856,"children":857},{"class":241,"line":693},[858],{"type":48,"tag":239,"props":859,"children":860},{},[861],{"type":53,"value":862},"  (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_admission_wait_seconds,\n",{"type":48,"tag":239,"props":864,"children":865},{"class":241,"line":702},[866],{"type":48,"tag":239,"props":867,"children":868},{},[869],{"type":53,"value":699},{"type":48,"tag":239,"props":871,"children":872},{"class":241,"line":711},[873],{"type":48,"tag":239,"props":874,"children":875},{},[876],{"type":53,"value":735},{"type":48,"tag":239,"props":878,"children":879},{"class":241,"line":720},[880],{"type":48,"tag":239,"props":881,"children":882},{},[883],{"type":53,"value":744},{"type":48,"tag":239,"props":885,"children":886},{"class":241,"line":729},[887],{"type":48,"tag":239,"props":888,"children":889},{},[890],{"type":53,"value":753},{"type":48,"tag":239,"props":892,"children":893},{"class":241,"line":738},[894],{"type":48,"tag":239,"props":895,"children":896},{},[897],{"type":53,"value":898},"  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n",{"type":48,"tag":239,"props":900,"children":901},{"class":241,"line":747},[902],{"type":48,"tag":239,"props":903,"children":904},{},[905],{"type":53,"value":906},"  AND (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 > 0\n",{"type":48,"tag":239,"props":908,"children":909},{"class":241,"line":756},[910],{"type":48,"tag":239,"props":911,"children":912},{},[913],{"type":53,"value":914},"ORDER BY (statistics->'execution_statistics'->'admissionWaitTime'->>'mean')::FLOAT8 DESC\n",{"type":48,"tag":239,"props":916,"children":917},{"class":241,"line":765},[918],{"type":48,"tag":239,"props":919,"children":920},{},[921],{"type":53,"value":780},{"type":48,"tag":56,"props":923,"children":924},{},[925,930],{"type":48,"tag":74,"props":926,"children":927},{},[928],{"type":53,"value":929},"Interpretation:",{"type":53,"value":931}," High admission wait = cluster at resource limits (CPU, memory, I\u002FO). Ratio > 1.0 (wait > runtime) indicates severe queueing.",{"type":48,"tag":268,"props":933,"children":935},{"id":934},"query-3-plan-hash-diversity",[936],{"type":53,"value":937},"Query 3: Plan Hash Diversity",{"type":48,"tag":229,"props":939,"children":941},{"className":231,"code":940,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'query' AS query_text,\n  COUNT(DISTINCT plan_hash) AS distinct_plan_count,\n  array_agg(DISTINCT plan_hash ORDER BY plan_hash) AS plan_hashes,\n  SUM((statistics->'statistics'->>'cnt')::INT) AS total_executions\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '7 days'\nGROUP BY fingerprint_id, metadata->>'db', metadata->>'query'\nHAVING COUNT(DISTINCT plan_hash) > 1\nORDER BY COUNT(DISTINCT plan_hash) DESC, SUM((statistics->'statistics'->>'cnt')::INT) DESC\nLIMIT 20;\n",[942],{"type":48,"tag":62,"props":943,"children":944},{"__ignoreMap":233},[945,952,959,966,973,981,989,997,1004,1012,1020,1028,1036],{"type":48,"tag":239,"props":946,"children":947},{"class":241,"line":242},[948],{"type":48,"tag":239,"props":949,"children":950},{},[951],{"type":53,"value":657},{"type":48,"tag":239,"props":953,"children":954},{"class":241,"line":29},[955],{"type":48,"tag":239,"props":956,"children":957},{},[958],{"type":53,"value":665},{"type":48,"tag":239,"props":960,"children":961},{"class":241,"line":25},[962],{"type":48,"tag":239,"props":963,"children":964},{},[965],{"type":53,"value":673},{"type":48,"tag":239,"props":967,"children":968},{"class":241,"line":602},[969],{"type":48,"tag":239,"props":970,"children":971},{},[972],{"type":53,"value":681},{"type":48,"tag":239,"props":974,"children":975},{"class":241,"line":684},[976],{"type":48,"tag":239,"props":977,"children":978},{},[979],{"type":53,"value":980},"  COUNT(DISTINCT plan_hash) AS distinct_plan_count,\n",{"type":48,"tag":239,"props":982,"children":983},{"class":241,"line":693},[984],{"type":48,"tag":239,"props":985,"children":986},{},[987],{"type":53,"value":988},"  array_agg(DISTINCT plan_hash ORDER BY plan_hash) AS plan_hashes,\n",{"type":48,"tag":239,"props":990,"children":991},{"class":241,"line":702},[992],{"type":48,"tag":239,"props":993,"children":994},{},[995],{"type":53,"value":996},"  SUM((statistics->'statistics'->>'cnt')::INT) AS total_executions\n",{"type":48,"tag":239,"props":998,"children":999},{"class":241,"line":711},[1000],{"type":48,"tag":239,"props":1001,"children":1002},{},[1003],{"type":53,"value":744},{"type":48,"tag":239,"props":1005,"children":1006},{"class":241,"line":720},[1007],{"type":48,"tag":239,"props":1008,"children":1009},{},[1010],{"type":53,"value":1011},"WHERE aggregated_ts > now() - INTERVAL '7 days'\n",{"type":48,"tag":239,"props":1013,"children":1014},{"class":241,"line":729},[1015],{"type":48,"tag":239,"props":1016,"children":1017},{},[1018],{"type":53,"value":1019},"GROUP BY fingerprint_id, metadata->>'db', metadata->>'query'\n",{"type":48,"tag":239,"props":1021,"children":1022},{"class":241,"line":738},[1023],{"type":48,"tag":239,"props":1024,"children":1025},{},[1026],{"type":53,"value":1027},"HAVING COUNT(DISTINCT plan_hash) > 1\n",{"type":48,"tag":239,"props":1029,"children":1030},{"class":241,"line":747},[1031],{"type":48,"tag":239,"props":1032,"children":1033},{},[1034],{"type":53,"value":1035},"ORDER BY COUNT(DISTINCT plan_hash) DESC, SUM((statistics->'statistics'->>'cnt')::INT) DESC\n",{"type":48,"tag":239,"props":1037,"children":1038},{"class":241,"line":756},[1039],{"type":48,"tag":239,"props":1040,"children":1041},{},[1042],{"type":53,"value":780},{"type":48,"tag":56,"props":1044,"children":1045},{},[1046,1050],{"type":48,"tag":74,"props":1047,"children":1048},{},[1049],{"type":53,"value":929},{"type":53,"value":1051}," Multiple plans indicate instability from schema changes, statistics updates, or routing changes. Performance can vary significantly between plans.",{"type":48,"tag":268,"props":1053,"children":1055},{"id":1054},"query-4-high-contention-statements",[1056],{"type":53,"value":1057},"Query 4: High Contention Statements",{"type":48,"tag":229,"props":1059,"children":1061},{"className":231,"code":1060,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  metadata->>'app' AS application,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'statistics'->>'cnt')::INT AS execution_count,\n  (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_contention_seconds,\n  ROUND(\n    ((statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9) \u002F\n    NULLIF((statistics->'statistics'->'runLat'->>'mean')::FLOAT8, 0) * 100, 2\n  ) AS contention_pct_of_runtime,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 > 0\nORDER BY (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n",[1062],{"type":48,"tag":62,"props":1063,"children":1064},{"__ignoreMap":233},[1065,1072,1079,1086,1094,1102,1109,1117,1125,1133,1141,1149,1156,1163,1170,1177,1186,1195],{"type":48,"tag":239,"props":1066,"children":1067},{"class":241,"line":242},[1068],{"type":48,"tag":239,"props":1069,"children":1070},{},[1071],{"type":53,"value":657},{"type":48,"tag":239,"props":1073,"children":1074},{"class":241,"line":29},[1075],{"type":48,"tag":239,"props":1076,"children":1077},{},[1078],{"type":53,"value":665},{"type":48,"tag":239,"props":1080,"children":1081},{"class":241,"line":25},[1082],{"type":48,"tag":239,"props":1083,"children":1084},{},[1085],{"type":53,"value":673},{"type":48,"tag":239,"props":1087,"children":1088},{"class":241,"line":602},[1089],{"type":48,"tag":239,"props":1090,"children":1091},{},[1092],{"type":53,"value":1093},"  metadata->>'app' AS application,\n",{"type":48,"tag":239,"props":1095,"children":1096},{"class":241,"line":684},[1097],{"type":48,"tag":239,"props":1098,"children":1099},{},[1100],{"type":53,"value":1101},"  substring(metadata->>'query', 1, 150) AS query_preview,\n",{"type":48,"tag":239,"props":1103,"children":1104},{"class":241,"line":693},[1105],{"type":48,"tag":239,"props":1106,"children":1107},{},[1108],{"type":53,"value":690},{"type":48,"tag":239,"props":1110,"children":1111},{"class":241,"line":702},[1112],{"type":48,"tag":239,"props":1113,"children":1114},{},[1115],{"type":53,"value":1116},"  (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9 AS mean_contention_seconds,\n",{"type":48,"tag":239,"props":1118,"children":1119},{"class":241,"line":711},[1120],{"type":48,"tag":239,"props":1121,"children":1122},{},[1123],{"type":53,"value":1124},"  ROUND(\n",{"type":48,"tag":239,"props":1126,"children":1127},{"class":241,"line":720},[1128],{"type":48,"tag":239,"props":1129,"children":1130},{},[1131],{"type":53,"value":1132},"    ((statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 \u002F 1e9) \u002F\n",{"type":48,"tag":239,"props":1134,"children":1135},{"class":241,"line":729},[1136],{"type":48,"tag":239,"props":1137,"children":1138},{},[1139],{"type":53,"value":1140},"    NULLIF((statistics->'statistics'->'runLat'->>'mean')::FLOAT8, 0) * 100, 2\n",{"type":48,"tag":239,"props":1142,"children":1143},{"class":241,"line":738},[1144],{"type":48,"tag":239,"props":1145,"children":1146},{},[1147],{"type":53,"value":1148},"  ) AS contention_pct_of_runtime,\n",{"type":48,"tag":239,"props":1150,"children":1151},{"class":241,"line":747},[1152],{"type":48,"tag":239,"props":1153,"children":1154},{},[1155],{"type":53,"value":735},{"type":48,"tag":239,"props":1157,"children":1158},{"class":241,"line":756},[1159],{"type":48,"tag":239,"props":1160,"children":1161},{},[1162],{"type":53,"value":744},{"type":48,"tag":239,"props":1164,"children":1165},{"class":241,"line":765},[1166],{"type":48,"tag":239,"props":1167,"children":1168},{},[1169],{"type":53,"value":753},{"type":48,"tag":239,"props":1171,"children":1172},{"class":241,"line":774},[1173],{"type":48,"tag":239,"props":1174,"children":1175},{},[1176],{"type":53,"value":898},{"type":48,"tag":239,"props":1178,"children":1180},{"class":241,"line":1179},16,[1181],{"type":48,"tag":239,"props":1182,"children":1183},{},[1184],{"type":53,"value":1185},"  AND (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 > 0\n",{"type":48,"tag":239,"props":1187,"children":1189},{"class":241,"line":1188},17,[1190],{"type":48,"tag":239,"props":1191,"children":1192},{},[1193],{"type":53,"value":1194},"ORDER BY (statistics->'execution_statistics'->'contentionTime'->>'mean')::FLOAT8 DESC\n",{"type":48,"tag":239,"props":1196,"children":1198},{"class":241,"line":1197},18,[1199],{"type":48,"tag":239,"props":1200,"children":1201},{},[1202],{"type":53,"value":780},{"type":48,"tag":56,"props":1204,"children":1205},{},[1206,1210],{"type":48,"tag":74,"props":1207,"children":1208},{},[1209],{"type":53,"value":929},{"type":53,"value":1211}," >20% contention = transaction conflicts, hot row access. Remediate with batching, transaction boundary changes, or schema redesign.",{"type":48,"tag":268,"props":1213,"children":1215},{"id":1214},"query-5-high-cpu-consumers",[1216],{"type":53,"value":1217},"Query 5: High CPU Consumers",{"type":48,"tag":229,"props":1219,"children":1221},{"className":231,"code":1220,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9 AS mean_cpu_seconds,\n  (statistics->'statistics'->>'cnt')::INT AS total_executions,\n  ROUND(\n    ((statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9) *\n    (statistics->'statistics'->>'cnt')::INT, 2\n  ) AS estimated_total_cpu_seconds,\n  (metadata->>'fullScan')::BOOL AS full_scan,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 > 0\nORDER BY estimated_total_cpu_seconds DESC\nLIMIT 20;\n",[1222],{"type":48,"tag":62,"props":1223,"children":1224},{"__ignoreMap":233},[1225,1232,1239,1246,1253,1261,1269,1276,1284,1292,1300,1307,1314,1321,1328,1335,1343,1351],{"type":48,"tag":239,"props":1226,"children":1227},{"class":241,"line":242},[1228],{"type":48,"tag":239,"props":1229,"children":1230},{},[1231],{"type":53,"value":657},{"type":48,"tag":239,"props":1233,"children":1234},{"class":241,"line":29},[1235],{"type":48,"tag":239,"props":1236,"children":1237},{},[1238],{"type":53,"value":665},{"type":48,"tag":239,"props":1240,"children":1241},{"class":241,"line":25},[1242],{"type":48,"tag":239,"props":1243,"children":1244},{},[1245],{"type":53,"value":673},{"type":48,"tag":239,"props":1247,"children":1248},{"class":241,"line":602},[1249],{"type":48,"tag":239,"props":1250,"children":1251},{},[1252],{"type":53,"value":1101},{"type":48,"tag":239,"props":1254,"children":1255},{"class":241,"line":684},[1256],{"type":48,"tag":239,"props":1257,"children":1258},{},[1259],{"type":53,"value":1260},"  (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9 AS mean_cpu_seconds,\n",{"type":48,"tag":239,"props":1262,"children":1263},{"class":241,"line":693},[1264],{"type":48,"tag":239,"props":1265,"children":1266},{},[1267],{"type":53,"value":1268},"  (statistics->'statistics'->>'cnt')::INT AS total_executions,\n",{"type":48,"tag":239,"props":1270,"children":1271},{"class":241,"line":702},[1272],{"type":48,"tag":239,"props":1273,"children":1274},{},[1275],{"type":53,"value":1124},{"type":48,"tag":239,"props":1277,"children":1278},{"class":241,"line":711},[1279],{"type":48,"tag":239,"props":1280,"children":1281},{},[1282],{"type":53,"value":1283},"    ((statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 \u002F 1e9) *\n",{"type":48,"tag":239,"props":1285,"children":1286},{"class":241,"line":720},[1287],{"type":48,"tag":239,"props":1288,"children":1289},{},[1290],{"type":53,"value":1291},"    (statistics->'statistics'->>'cnt')::INT, 2\n",{"type":48,"tag":239,"props":1293,"children":1294},{"class":241,"line":729},[1295],{"type":48,"tag":239,"props":1296,"children":1297},{},[1298],{"type":53,"value":1299},"  ) AS estimated_total_cpu_seconds,\n",{"type":48,"tag":239,"props":1301,"children":1302},{"class":241,"line":738},[1303],{"type":48,"tag":239,"props":1304,"children":1305},{},[1306],{"type":53,"value":717},{"type":48,"tag":239,"props":1308,"children":1309},{"class":241,"line":747},[1310],{"type":48,"tag":239,"props":1311,"children":1312},{},[1313],{"type":53,"value":735},{"type":48,"tag":239,"props":1315,"children":1316},{"class":241,"line":756},[1317],{"type":48,"tag":239,"props":1318,"children":1319},{},[1320],{"type":53,"value":744},{"type":48,"tag":239,"props":1322,"children":1323},{"class":241,"line":765},[1324],{"type":48,"tag":239,"props":1325,"children":1326},{},[1327],{"type":53,"value":753},{"type":48,"tag":239,"props":1329,"children":1330},{"class":241,"line":774},[1331],{"type":48,"tag":239,"props":1332,"children":1333},{},[1334],{"type":53,"value":898},{"type":48,"tag":239,"props":1336,"children":1337},{"class":241,"line":1179},[1338],{"type":48,"tag":239,"props":1339,"children":1340},{},[1341],{"type":53,"value":1342},"  AND (statistics->'execution_statistics'->'cpuSQLNanos'->>'mean')::FLOAT8 > 0\n",{"type":48,"tag":239,"props":1344,"children":1345},{"class":241,"line":1188},[1346],{"type":48,"tag":239,"props":1347,"children":1348},{},[1349],{"type":53,"value":1350},"ORDER BY estimated_total_cpu_seconds DESC\n",{"type":48,"tag":239,"props":1352,"children":1353},{"class":241,"line":1197},[1354],{"type":48,"tag":239,"props":1355,"children":1356},{},[1357],{"type":53,"value":780},{"type":48,"tag":56,"props":1359,"children":1360},{},[1361,1365,1367,1373,1375,1381],{"type":48,"tag":74,"props":1362,"children":1363},{},[1364],{"type":53,"value":788},{"type":53,"value":1366}," ",{"type":48,"tag":62,"props":1368,"children":1370},{"className":1369},[],[1371],{"type":53,"value":1372},"estimated_total_cpu_seconds",{"type":53,"value":1374}," shows cluster impact. High mean CPU often correlates with ",{"type":48,"tag":62,"props":1376,"children":1378},{"className":1377},[],[1379],{"type":53,"value":1380},"full_scan = true",{"type":53,"value":89},{"type":48,"tag":268,"props":1383,"children":1385},{"id":1384},"query-6-memory-and-disk-spill-detection",[1386],{"type":53,"value":1387},"Query 6: Memory and Disk Spill Detection",{"type":48,"tag":229,"props":1389,"children":1391},{"className":231,"code":1390,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'execution_statistics'->'maxMemUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_mem_mb,\n  (statistics->'execution_statistics'->'maxMemUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_mem_mb,\n  (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_disk_mb,\n  (statistics->'execution_statistics'->'maxDiskUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_disk_mb,\n  metadata->>'stmtType' AS statement_type,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'execution_statistics'->>'cnt') IS NOT NULL\n  AND (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 > 0  -- Has disk spills\nORDER BY (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 DESC\nLIMIT 20;\n",[1392],{"type":48,"tag":62,"props":1393,"children":1394},{"__ignoreMap":233},[1395,1402,1409,1416,1423,1431,1439,1447,1455,1463,1470,1477,1484,1491,1499,1507],{"type":48,"tag":239,"props":1396,"children":1397},{"class":241,"line":242},[1398],{"type":48,"tag":239,"props":1399,"children":1400},{},[1401],{"type":53,"value":657},{"type":48,"tag":239,"props":1403,"children":1404},{"class":241,"line":29},[1405],{"type":48,"tag":239,"props":1406,"children":1407},{},[1408],{"type":53,"value":665},{"type":48,"tag":239,"props":1410,"children":1411},{"class":241,"line":25},[1412],{"type":48,"tag":239,"props":1413,"children":1414},{},[1415],{"type":53,"value":673},{"type":48,"tag":239,"props":1417,"children":1418},{"class":241,"line":602},[1419],{"type":48,"tag":239,"props":1420,"children":1421},{},[1422],{"type":53,"value":1101},{"type":48,"tag":239,"props":1424,"children":1425},{"class":241,"line":684},[1426],{"type":48,"tag":239,"props":1427,"children":1428},{},[1429],{"type":53,"value":1430},"  (statistics->'execution_statistics'->'maxMemUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_mem_mb,\n",{"type":48,"tag":239,"props":1432,"children":1433},{"class":241,"line":693},[1434],{"type":48,"tag":239,"props":1435,"children":1436},{},[1437],{"type":53,"value":1438},"  (statistics->'execution_statistics'->'maxMemUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_mem_mb,\n",{"type":48,"tag":239,"props":1440,"children":1441},{"class":241,"line":702},[1442],{"type":48,"tag":239,"props":1443,"children":1444},{},[1445],{"type":53,"value":1446},"  (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 \u002F 1048576 AS mean_disk_mb,\n",{"type":48,"tag":239,"props":1448,"children":1449},{"class":241,"line":711},[1450],{"type":48,"tag":239,"props":1451,"children":1452},{},[1453],{"type":53,"value":1454},"  (statistics->'execution_statistics'->'maxDiskUsage'->>'max')::FLOAT8 \u002F 1048576 AS max_disk_mb,\n",{"type":48,"tag":239,"props":1456,"children":1457},{"class":241,"line":720},[1458],{"type":48,"tag":239,"props":1459,"children":1460},{},[1461],{"type":53,"value":1462},"  metadata->>'stmtType' AS statement_type,\n",{"type":48,"tag":239,"props":1464,"children":1465},{"class":241,"line":729},[1466],{"type":48,"tag":239,"props":1467,"children":1468},{},[1469],{"type":53,"value":735},{"type":48,"tag":239,"props":1471,"children":1472},{"class":241,"line":738},[1473],{"type":48,"tag":239,"props":1474,"children":1475},{},[1476],{"type":53,"value":744},{"type":48,"tag":239,"props":1478,"children":1479},{"class":241,"line":747},[1480],{"type":48,"tag":239,"props":1481,"children":1482},{},[1483],{"type":53,"value":753},{"type":48,"tag":239,"props":1485,"children":1486},{"class":241,"line":756},[1487],{"type":48,"tag":239,"props":1488,"children":1489},{},[1490],{"type":53,"value":898},{"type":48,"tag":239,"props":1492,"children":1493},{"class":241,"line":765},[1494],{"type":48,"tag":239,"props":1495,"children":1496},{},[1497],{"type":53,"value":1498},"  AND (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 > 0  -- Has disk spills\n",{"type":48,"tag":239,"props":1500,"children":1501},{"class":241,"line":774},[1502],{"type":48,"tag":239,"props":1503,"children":1504},{},[1505],{"type":53,"value":1506},"ORDER BY (statistics->'execution_statistics'->'maxDiskUsage'->>'mean')::FLOAT8 DESC\n",{"type":48,"tag":239,"props":1508,"children":1509},{"class":241,"line":1179},[1510],{"type":48,"tag":239,"props":1511,"children":1512},{},[1513],{"type":53,"value":780},{"type":48,"tag":56,"props":1515,"children":1516},{},[1517,1521,1523,1529],{"type":48,"tag":74,"props":1518,"children":1519},{},[1520],{"type":53,"value":929},{"type":53,"value":1522}," Disk usage > 0 = memory spill (~100-1000x slower than in-memory). Common for large aggregations, sorts, hash joins. Fix with indexes or increased ",{"type":48,"tag":62,"props":1524,"children":1526},{"className":1525},[],[1527],{"type":53,"value":1528},"sql.distsql.temp_storage.workmem",{"type":53,"value":89},{"type":48,"tag":268,"props":1531,"children":1533},{"id":1532},"query-7-error-prone-statements",[1534],{"type":53,"value":1535},"Query 7: Error-Prone Statements",{"type":48,"tag":229,"props":1537,"children":1539},{"className":231,"code":1538,"language":21,"meta":233,"style":233},"SELECT\n  fingerprint_id,\n  metadata->>'db' AS database,\n  substring(metadata->>'query', 1, 150) AS query_preview,\n  (statistics->'statistics'->>'cnt')::INT AS total_executions,\n  COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) AS failure_count,\n  ROUND(\n    COALESCE((statistics->'statistics'->>'failureCount')::INT, 0)::NUMERIC \u002F\n    NULLIF((statistics->'statistics'->>'cnt')::INT, 0) * 100, 2\n  ) AS failure_rate_pct,\n  aggregated_ts\nFROM crdb_internal.statement_statistics\nWHERE aggregated_ts > now() - INTERVAL '24 hours'\n  AND (statistics->'statistics'->>'cnt')::INT > 10\n  AND COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) > 0\nORDER BY failure_rate_pct DESC, failure_count DESC\nLIMIT 20;\n",[1540],{"type":48,"tag":62,"props":1541,"children":1542},{"__ignoreMap":233},[1543,1550,1557,1564,1571,1578,1586,1593,1601,1609,1617,1624,1631,1638,1646,1654,1662],{"type":48,"tag":239,"props":1544,"children":1545},{"class":241,"line":242},[1546],{"type":48,"tag":239,"props":1547,"children":1548},{},[1549],{"type":53,"value":657},{"type":48,"tag":239,"props":1551,"children":1552},{"class":241,"line":29},[1553],{"type":48,"tag":239,"props":1554,"children":1555},{},[1556],{"type":53,"value":665},{"type":48,"tag":239,"props":1558,"children":1559},{"class":241,"line":25},[1560],{"type":48,"tag":239,"props":1561,"children":1562},{},[1563],{"type":53,"value":673},{"type":48,"tag":239,"props":1565,"children":1566},{"class":241,"line":602},[1567],{"type":48,"tag":239,"props":1568,"children":1569},{},[1570],{"type":53,"value":1101},{"type":48,"tag":239,"props":1572,"children":1573},{"class":241,"line":684},[1574],{"type":48,"tag":239,"props":1575,"children":1576},{},[1577],{"type":53,"value":1268},{"type":48,"tag":239,"props":1579,"children":1580},{"class":241,"line":693},[1581],{"type":48,"tag":239,"props":1582,"children":1583},{},[1584],{"type":53,"value":1585},"  COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) AS failure_count,\n",{"type":48,"tag":239,"props":1587,"children":1588},{"class":241,"line":702},[1589],{"type":48,"tag":239,"props":1590,"children":1591},{},[1592],{"type":53,"value":1124},{"type":48,"tag":239,"props":1594,"children":1595},{"class":241,"line":711},[1596],{"type":48,"tag":239,"props":1597,"children":1598},{},[1599],{"type":53,"value":1600},"    COALESCE((statistics->'statistics'->>'failureCount')::INT, 0)::NUMERIC \u002F\n",{"type":48,"tag":239,"props":1602,"children":1603},{"class":241,"line":720},[1604],{"type":48,"tag":239,"props":1605,"children":1606},{},[1607],{"type":53,"value":1608},"    NULLIF((statistics->'statistics'->>'cnt')::INT, 0) * 100, 2\n",{"type":48,"tag":239,"props":1610,"children":1611},{"class":241,"line":729},[1612],{"type":48,"tag":239,"props":1613,"children":1614},{},[1615],{"type":53,"value":1616},"  ) AS failure_rate_pct,\n",{"type":48,"tag":239,"props":1618,"children":1619},{"class":241,"line":738},[1620],{"type":48,"tag":239,"props":1621,"children":1622},{},[1623],{"type":53,"value":735},{"type":48,"tag":239,"props":1625,"children":1626},{"class":241,"line":747},[1627],{"type":48,"tag":239,"props":1628,"children":1629},{},[1630],{"type":53,"value":744},{"type":48,"tag":239,"props":1632,"children":1633},{"class":241,"line":756},[1634],{"type":48,"tag":239,"props":1635,"children":1636},{},[1637],{"type":53,"value":753},{"type":48,"tag":239,"props":1639,"children":1640},{"class":241,"line":765},[1641],{"type":48,"tag":239,"props":1642,"children":1643},{},[1644],{"type":53,"value":1645},"  AND (statistics->'statistics'->>'cnt')::INT > 10\n",{"type":48,"tag":239,"props":1647,"children":1648},{"class":241,"line":774},[1649],{"type":48,"tag":239,"props":1650,"children":1651},{},[1652],{"type":53,"value":1653},"  AND COALESCE((statistics->'statistics'->>'failureCount')::INT, 0) > 0\n",{"type":48,"tag":239,"props":1655,"children":1656},{"class":241,"line":1179},[1657],{"type":48,"tag":239,"props":1658,"children":1659},{},[1660],{"type":53,"value":1661},"ORDER BY failure_rate_pct DESC, failure_count DESC\n",{"type":48,"tag":239,"props":1663,"children":1664},{"class":241,"line":1188},[1665],{"type":48,"tag":239,"props":1666,"children":1667},{},[1668],{"type":53,"value":780},{"type":48,"tag":56,"props":1670,"children":1671},{},[1672,1677],{"type":48,"tag":74,"props":1673,"children":1674},{},[1675],{"type":53,"value":1676},"Common causes:",{"type":53,"value":1678}," Constraint violations, query timeouts, transaction retry errors (40001), permission denied.",{"type":48,"tag":91,"props":1680,"children":1682},{"id":1681},"common-workflows",[1683],{"type":53,"value":1684},"Common Workflows",{"type":48,"tag":268,"props":1686,"children":1688},{"id":1687},"workflow-1-slowness-investigation",[1689],{"type":53,"value":1690},"Workflow 1: Slowness Investigation",{"type":48,"tag":1692,"props":1693,"children":1694},"ol",{},[1695,1713,1735,1753],{"type":48,"tag":102,"props":1696,"children":1697},{},[1698,1703,1705,1711],{"type":48,"tag":74,"props":1699,"children":1700},{},[1701],{"type":53,"value":1702},"Identify slow fingerprints:",{"type":53,"value":1704}," Run Query 1 with 24h window, focus on ",{"type":48,"tag":62,"props":1706,"children":1708},{"className":1707},[],[1709],{"type":53,"value":1710},"mean_run_lat_seconds > 5",{"type":53,"value":1712}," and high execution counts",{"type":48,"tag":102,"props":1714,"children":1715},{},[1716,1721,1723,1728,1730],{"type":48,"tag":74,"props":1717,"children":1718},{},[1719],{"type":53,"value":1720},"Check for full scans:",{"type":53,"value":1722}," Filter ",{"type":48,"tag":62,"props":1724,"children":1726},{"className":1725},[],[1727],{"type":53,"value":1380},{"type":53,"value":1729},", review ",{"type":48,"tag":62,"props":1731,"children":1733},{"className":1732},[],[1734],{"type":53,"value":804},{"type":48,"tag":102,"props":1736,"children":1737},{},[1738,1743,1745,1751],{"type":48,"tag":74,"props":1739,"children":1740},{},[1741],{"type":53,"value":1742},"Correlate to applications:",{"type":53,"value":1744}," Group by ",{"type":48,"tag":62,"props":1746,"children":1748},{"className":1747},[],[1749],{"type":53,"value":1750},"metadata->>'app'",{"type":53,"value":1752},", contact teams with specific patterns",{"type":48,"tag":102,"props":1754,"children":1755},{},[1756,1761],{"type":48,"tag":74,"props":1757,"children":1758},{},[1759],{"type":53,"value":1760},"Cross-reference live activity:",{"type":53,"value":1762}," If ongoing, use triaging-live-sql-activity to cancel runaway queries",{"type":48,"tag":268,"props":1764,"children":1766},{"id":1765},"workflow-2-contention-analysis",[1767],{"type":53,"value":1768},"Workflow 2: Contention Analysis",{"type":48,"tag":1692,"props":1770,"children":1771},{},[1772,1788,1798],{"type":48,"tag":102,"props":1773,"children":1774},{},[1775,1780,1782],{"type":48,"tag":74,"props":1776,"children":1777},{},[1778],{"type":53,"value":1779},"Find high-contention statements:",{"type":53,"value":1781}," Run Query 4, focus on ",{"type":48,"tag":62,"props":1783,"children":1785},{"className":1784},[],[1786],{"type":53,"value":1787},"contention_pct_of_runtime > 20%",{"type":48,"tag":102,"props":1789,"children":1790},{},[1791,1796],{"type":48,"tag":74,"props":1792,"children":1793},{},[1794],{"type":53,"value":1795},"Check plan stability:",{"type":53,"value":1797}," Run Query 3 for contending fingerprints (plan changes affect lock order)",{"type":48,"tag":102,"props":1799,"children":1800},{},[1801,1806,1808,1814],{"type":48,"tag":74,"props":1802,"children":1803},{},[1804],{"type":53,"value":1805},"Remediate:",{"type":53,"value":1807}," Batch operations, use ",{"type":48,"tag":62,"props":1809,"children":1811},{"className":1810},[],[1812],{"type":53,"value":1813},"SELECT FOR UPDATE",{"type":53,"value":1815},", partition hot tables, denormalize schema",{"type":48,"tag":268,"props":1817,"children":1819},{"id":1818},"workflow-3-admission-control-debugging",[1820],{"type":53,"value":1821},"Workflow 3: Admission Control Debugging",{"type":48,"tag":1692,"props":1823,"children":1824},{},[1825,1835,1845,1862],{"type":48,"tag":102,"props":1826,"children":1827},{},[1828,1833],{"type":48,"tag":74,"props":1829,"children":1830},{},[1831],{"type":53,"value":1832},"Identify admission waits:",{"type":53,"value":1834}," Run Query 2, calculate wait ratio",{"type":48,"tag":102,"props":1836,"children":1837},{},[1838,1843],{"type":48,"tag":74,"props":1839,"children":1840},{},[1841],{"type":53,"value":1842},"Correlate with CPU:",{"type":53,"value":1844}," Run Query 5 for same window, cross-reference fingerprint IDs",{"type":48,"tag":102,"props":1846,"children":1847},{},[1848,1853,1854,1860],{"type":48,"tag":74,"props":1849,"children":1850},{},[1851],{"type":53,"value":1852},"Analyze time patterns:",{"type":53,"value":1744},{"type":48,"tag":62,"props":1855,"children":1857},{"className":1856},[],[1858],{"type":53,"value":1859},"aggregated_ts",{"type":53,"value":1861}," to find peak periods",{"type":48,"tag":102,"props":1863,"children":1864},{},[1865,1870],{"type":48,"tag":74,"props":1866,"children":1867},{},[1868],{"type":53,"value":1869},"Triage:",{"type":53,"value":1871}," Short-term: spread batch jobs; Long-term: add capacity, optimize queries",{"type":48,"tag":268,"props":1873,"children":1875},{"id":1874},"workflow-4-memory-spill-investigation",[1876],{"type":53,"value":1877},"Workflow 4: Memory Spill Investigation",{"type":48,"tag":1692,"props":1879,"children":1880},{},[1881,1897,1923],{"type":48,"tag":102,"props":1882,"children":1883},{},[1884,1889,1891],{"type":48,"tag":74,"props":1885,"children":1886},{},[1887],{"type":53,"value":1888},"Find spilling statements:",{"type":53,"value":1890}," Run Query 6, focus on ",{"type":48,"tag":62,"props":1892,"children":1894},{"className":1893},[],[1895],{"type":53,"value":1896},"max_disk_mb > 100",{"type":48,"tag":102,"props":1898,"children":1899},{},[1900,1905,1907,1913,1915,1921],{"type":48,"tag":74,"props":1901,"children":1902},{},[1903],{"type":53,"value":1904},"Analyze patterns:",{"type":53,"value":1906}," Identify large ",{"type":48,"tag":62,"props":1908,"children":1910},{"className":1909},[],[1911],{"type":53,"value":1912},"GROUP BY",{"type":53,"value":1914},", ",{"type":48,"tag":62,"props":1916,"children":1918},{"className":1917},[],[1919],{"type":53,"value":1920},"ORDER BY",{"type":53,"value":1922},", hash joins",{"type":48,"tag":102,"props":1924,"children":1925},{},[1926,1930],{"type":48,"tag":74,"props":1927,"children":1928},{},[1929],{"type":53,"value":1805},{"type":53,"value":1931}," Add indexes, increase workmem (with caution), rewrite queries, use materialized views",{"type":48,"tag":91,"props":1933,"children":1935},{"id":1934},"safety-considerations",[1936],{"type":53,"value":1937},"Safety Considerations",{"type":48,"tag":56,"props":1939,"children":1940},{},[1941,1946,1948,1954,1956,1961],{"type":48,"tag":74,"props":1942,"children":1943},{},[1944],{"type":53,"value":1945},"Read-only operations:",{"type":53,"value":1947}," All queries are ",{"type":48,"tag":62,"props":1949,"children":1951},{"className":1950},[],[1952],{"type":53,"value":1953},"SELECT",{"type":53,"value":1955}," statements against production-approved ",{"type":48,"tag":62,"props":1957,"children":1959},{"className":1958},[],[1960],{"type":53,"value":67},{"type":53,"value":89},{"type":48,"tag":56,"props":1963,"children":1964},{},[1965],{"type":48,"tag":74,"props":1966,"children":1967},{},[1968],{"type":53,"value":1969},"Performance impact:",{"type":48,"tag":390,"props":1971,"children":1972},{},[1973,1994],{"type":48,"tag":394,"props":1974,"children":1975},{},[1976],{"type":48,"tag":398,"props":1977,"children":1978},{},[1979,1984,1989],{"type":48,"tag":402,"props":1980,"children":1981},{},[1982],{"type":53,"value":1983},"Consideration",{"type":48,"tag":402,"props":1985,"children":1986},{},[1987],{"type":53,"value":1988},"Impact",{"type":48,"tag":402,"props":1990,"children":1991},{},[1992],{"type":53,"value":1993},"Mitigation",{"type":48,"tag":423,"props":1995,"children":1996},{},[1997,2021,2039],{"type":48,"tag":398,"props":1998,"children":1999},{},[2000,2005,2010],{"type":48,"tag":430,"props":2001,"children":2002},{},[2003],{"type":53,"value":2004},"Large table",{"type":48,"tag":430,"props":2006,"children":2007},{},[2008],{"type":53,"value":2009},"Many rows with high statement diversity",{"type":48,"tag":430,"props":2011,"children":2012},{},[2013,2015],{"type":53,"value":2014},"Always use time filters and ",{"type":48,"tag":62,"props":2016,"children":2018},{"className":2017},[],[2019],{"type":53,"value":2020},"LIMIT",{"type":48,"tag":398,"props":2022,"children":2023},{},[2024,2029,2034],{"type":48,"tag":430,"props":2025,"children":2026},{},[2027],{"type":53,"value":2028},"JSON parsing",{"type":48,"tag":430,"props":2030,"children":2031},{},[2032],{"type":53,"value":2033},"CPU overhead",{"type":48,"tag":430,"props":2035,"children":2036},{},[2037],{"type":53,"value":2038},"Use specific time windows, avoid tight loops",{"type":48,"tag":398,"props":2040,"children":2041},{},[2042,2047,2052],{"type":48,"tag":430,"props":2043,"children":2044},{},[2045],{"type":53,"value":2046},"Broad windows",{"type":48,"tag":430,"props":2048,"children":2049},{},[2050],{"type":53,"value":2051},"7-day queries = more rows",{"type":48,"tag":430,"props":2053,"children":2054},{},[2055],{"type":53,"value":2056},"Default to 24h; expand only when needed",{"type":48,"tag":56,"props":2058,"children":2059},{},[2060,2065,2066,2071],{"type":48,"tag":74,"props":2061,"children":2062},{},[2063],{"type":53,"value":2064},"Privacy:",{"type":53,"value":141},{"type":48,"tag":62,"props":2067,"children":2069},{"className":2068},[],[2070],{"type":53,"value":206},{"type":53,"value":2072}," to redact query constants in multi-tenant environments.",{"type":48,"tag":91,"props":2074,"children":2076},{"id":2075},"troubleshooting",[2077],{"type":53,"value":2078},"Troubleshooting",{"type":48,"tag":390,"props":2080,"children":2081},{},[2082,2103],{"type":48,"tag":394,"props":2083,"children":2084},{},[2085],{"type":48,"tag":398,"props":2086,"children":2087},{},[2088,2093,2098],{"type":48,"tag":402,"props":2089,"children":2090},{},[2091],{"type":53,"value":2092},"Issue",{"type":48,"tag":402,"props":2094,"children":2095},{},[2096],{"type":53,"value":2097},"Cause",{"type":48,"tag":402,"props":2099,"children":2100},{},[2101],{"type":53,"value":2102},"Fix",{"type":48,"tag":423,"props":2104,"children":2105},{},[2106,2129,2151,2174,2198,2230,2248],{"type":48,"tag":398,"props":2107,"children":2108},{},[2109,2114,2119],{"type":48,"tag":430,"props":2110,"children":2111},{},[2112],{"type":53,"value":2113},"Empty results",{"type":48,"tag":430,"props":2115,"children":2116},{},[2117],{"type":53,"value":2118},"No data or stats collection disabled",{"type":48,"tag":430,"props":2120,"children":2121},{},[2122,2124],{"type":53,"value":2123},"Check ",{"type":48,"tag":62,"props":2125,"children":2127},{"className":2126},[],[2128],{"type":53,"value":219},{"type":48,"tag":398,"props":2130,"children":2131},{},[2132,2141,2146],{"type":48,"tag":430,"props":2133,"children":2134},{},[2135],{"type":48,"tag":62,"props":2136,"children":2138},{"className":2137},[],[2139],{"type":53,"value":2140},"column does not exist",{"type":48,"tag":430,"props":2142,"children":2143},{},[2144],{"type":53,"value":2145},"JSON field typo or version mismatch",{"type":48,"tag":430,"props":2147,"children":2148},{},[2149],{"type":53,"value":2150},"Verify field names; check CockroachDB version",{"type":48,"tag":398,"props":2152,"children":2153},{},[2154,2159,2164],{"type":48,"tag":430,"props":2155,"children":2156},{},[2157],{"type":53,"value":2158},"NULL in sampled metrics",{"type":48,"tag":430,"props":2160,"children":2161},{},[2162],{"type":53,"value":2163},"Metric not sampled in bucket",{"type":48,"tag":430,"props":2165,"children":2166},{},[2167,2169],{"type":53,"value":2168},"Filter: ",{"type":48,"tag":62,"props":2170,"children":2172},{"className":2171},[],[2173],{"type":53,"value":510},{"type":48,"tag":398,"props":2175,"children":2176},{},[2177,2188,2193],{"type":48,"tag":430,"props":2178,"children":2179},{},[2180,2182],{"type":53,"value":2181},"Query text shows ",{"type":48,"tag":62,"props":2183,"children":2185},{"className":2184},[],[2186],{"type":53,"value":2187},"\u003Chidden>",{"type":48,"tag":430,"props":2189,"children":2190},{},[2191],{"type":53,"value":2192},"Using VIEWACTIVITYREDACTED",{"type":48,"tag":430,"props":2194,"children":2195},{},[2196],{"type":53,"value":2197},"Expected; use VIEWACTIVITY if authorized",{"type":48,"tag":398,"props":2199,"children":2200},{},[2201,2206,2211],{"type":48,"tag":430,"props":2202,"children":2203},{},[2204],{"type":53,"value":2205},"\"invalid input syntax for type json\"",{"type":48,"tag":430,"props":2207,"children":2208},{},[2209],{"type":53,"value":2210},"Malformed JSON path",{"type":48,"tag":430,"props":2212,"children":2213},{},[2214,2216,2221,2223,2228],{"type":53,"value":2215},"Check operators: ",{"type":48,"tag":62,"props":2217,"children":2219},{"className":2218},[],[2220],{"type":53,"value":536},{"type":53,"value":2222}," for JSON, ",{"type":48,"tag":62,"props":2224,"children":2226},{"className":2225},[],[2227],{"type":53,"value":547},{"type":53,"value":2229}," for text",{"type":48,"tag":398,"props":2231,"children":2232},{},[2233,2238,2243],{"type":48,"tag":430,"props":2234,"children":2235},{},[2236],{"type":53,"value":2237},"Very slow query",{"type":48,"tag":430,"props":2239,"children":2240},{},[2241],{"type":53,"value":2242},"Large table, no time filter",{"type":48,"tag":430,"props":2244,"children":2245},{},[2246],{"type":53,"value":2247},"Always add time window and LIMIT",{"type":48,"tag":398,"props":2249,"children":2250},{},[2251,2261,2266],{"type":48,"tag":430,"props":2252,"children":2253},{},[2254,2256],{"type":53,"value":2255},"Empty ",{"type":48,"tag":62,"props":2257,"children":2259},{"className":2258},[],[2260],{"type":53,"value":804},{"type":48,"tag":430,"props":2262,"children":2263},{},[2264],{"type":53,"value":2265},"No recommendations or optimal",{"type":48,"tag":430,"props":2267,"children":2268},{},[2269],{"type":53,"value":2270},"Normal if indexes exist",{"type":48,"tag":91,"props":2272,"children":2274},{"id":2273},"key-considerations",[2275],{"type":53,"value":2276},"Key Considerations",{"type":48,"tag":98,"props":2278,"children":2279},{},[2280,2290,2307,2317,2326,2336,2346,2362],{"type":48,"tag":102,"props":2281,"children":2282},{},[2283,2288],{"type":48,"tag":74,"props":2284,"children":2285},{},[2286],{"type":53,"value":2287},"Time windows:",{"type":53,"value":2289}," Default to 24h; expand to 7d for trends",{"type":48,"tag":102,"props":2291,"children":2292},{},[2293,2298,2300,2306],{"type":48,"tag":74,"props":2294,"children":2295},{},[2296],{"type":53,"value":2297},"Sampled metrics:",{"type":53,"value":2299}," Not all executions captured; check sample size (",{"type":48,"tag":62,"props":2301,"children":2303},{"className":2302},[],[2304],{"type":53,"value":2305},"cnt",{"type":53,"value":299},{"type":48,"tag":102,"props":2308,"children":2309},{},[2310,2315],{"type":48,"tag":74,"props":2311,"children":2312},{},[2313],{"type":53,"value":2314},"JSON safety:",{"type":53,"value":2316}," Use defensive NULL checks; handle type casting errors",{"type":48,"tag":102,"props":2318,"children":2319},{},[2320,2324],{"type":48,"tag":74,"props":2321,"children":2322},{},[2323],{"type":53,"value":2064},{"type":53,"value":2325}," Use VIEWACTIVITYREDACTED in production",{"type":48,"tag":102,"props":2327,"children":2328},{},[2329,2334],{"type":48,"tag":74,"props":2330,"children":2331},{},[2332],{"type":53,"value":2333},"Performance:",{"type":53,"value":2335}," Always include time filters and LIMIT",{"type":48,"tag":102,"props":2337,"children":2338},{},[2339,2344],{"type":48,"tag":74,"props":2340,"children":2341},{},[2342],{"type":53,"value":2343},"Complement to live triage:",{"type":53,"value":2345}," Use together for complete coverage (historical + real-time)",{"type":48,"tag":102,"props":2347,"children":2348},{},[2349,2353,2355,2360],{"type":48,"tag":74,"props":2350,"children":2351},{},[2352],{"type":53,"value":359},{"type":53,"value":2354}," Bounded by the row-count cap ",{"type":48,"tag":62,"props":2356,"children":2358},{"className":2357},[],[2359],{"type":53,"value":367},{"type":53,"value":2361}," (default 1,000,000), not a TTL; effective time window varies with workload diversity",{"type":48,"tag":102,"props":2363,"children":2364},{},[2365,2370],{"type":48,"tag":74,"props":2366,"children":2367},{},[2368],{"type":53,"value":2369},"Plan instability:",{"type":53,"value":2371}," Multiple plan hashes indicate optimizer\u002Fschema changes",{"type":48,"tag":91,"props":2373,"children":2375},{"id":2374},"references",[2376],{"type":53,"value":2377},"References",{"type":48,"tag":56,"props":2379,"children":2380},{},[2381],{"type":48,"tag":74,"props":2382,"children":2383},{},[2384],{"type":53,"value":2385},"Skill references:",{"type":48,"tag":98,"props":2387,"children":2388},{},[2389,2397,2406,2415],{"type":48,"tag":102,"props":2390,"children":2391},{},[2392],{"type":48,"tag":82,"props":2393,"children":2394},{"href":625},[2395],{"type":53,"value":2396},"JSON field schema and extraction",{"type":48,"tag":102,"props":2398,"children":2399},{},[2400],{"type":48,"tag":82,"props":2401,"children":2403},{"href":2402},"references\u002Fmetrics-and-units.md",[2404],{"type":53,"value":2405},"Metrics catalog and units",{"type":48,"tag":102,"props":2407,"children":2408},{},[2409],{"type":48,"tag":82,"props":2410,"children":2412},{"href":2411},"references\u002Fsql-query-variations.md",[2413],{"type":53,"value":2414},"SQL query variations",{"type":48,"tag":102,"props":2416,"children":2417},{},[2418,2423],{"type":48,"tag":82,"props":2419,"children":2420},{"href":255},[2421],{"type":53,"value":2422},"RBAC and privileges",{"type":53,"value":2424}," (shared with triaging-live-sql-activity)",{"type":48,"tag":56,"props":2426,"children":2427},{},[2428],{"type":48,"tag":74,"props":2429,"children":2430},{},[2431],{"type":53,"value":2432},"Official CockroachDB Documentation:",{"type":48,"tag":98,"props":2434,"children":2435},{},[2436,2447,2457,2467],{"type":48,"tag":102,"props":2437,"children":2438},{},[2439],{"type":48,"tag":82,"props":2440,"children":2444},{"href":2441,"rel":2442},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fcrdb-internal.html",[2443],"nofollow",[2445],{"type":53,"value":2446},"crdb_internal",{"type":48,"tag":102,"props":2448,"children":2449},{},[2450],{"type":48,"tag":82,"props":2451,"children":2454},{"href":2452,"rel":2453},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fui-statements-page.html",[2443],[2455],{"type":53,"value":2456},"Statements Page (DB Console)",{"type":48,"tag":102,"props":2458,"children":2459},{},[2460],{"type":48,"tag":82,"props":2461,"children":2464},{"href":2462,"rel":2463},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fmonitor-and-analyze-transaction-contention.html",[2443],[2465],{"type":53,"value":2466},"Monitor and Analyze Transaction Contention",{"type":48,"tag":102,"props":2468,"children":2469},{},[2470],{"type":48,"tag":82,"props":2471,"children":2474},{"href":2472,"rel":2473},"https:\u002F\u002Fwww.cockroachlabs.com\u002Fdocs\u002Fstable\u002Fsecurity-reference\u002Fauthorization.html#supported-privileges",[2443],[2475],{"type":53,"value":2476},"VIEWACTIVITY privilege",{"type":48,"tag":56,"props":2478,"children":2479},{},[2480],{"type":48,"tag":74,"props":2481,"children":2482},{},[2483],{"type":53,"value":2484},"Related skills:",{"type":48,"tag":98,"props":2486,"children":2487},{},[2488,2497],{"type":48,"tag":102,"props":2489,"children":2490},{},[2491,2495],{"type":48,"tag":82,"props":2492,"children":2493},{"href":84},[2494],{"type":53,"value":87},{"type":53,"value":2496}," - For immediate triage of currently running queries",{"type":48,"tag":102,"props":2498,"children":2499},{},[2500,2504],{"type":48,"tag":82,"props":2501,"children":2502},{"href":156},[2503],{"type":53,"value":159},{"type":53,"value":2505}," - For transaction-level analysis including retry patterns and commit latency",{"type":48,"tag":2507,"props":2508,"children":2509},"style",{},[2510],{"type":53,"value":2511},"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":2513,"total":2605},[2514,2526,2539,2556,2569,2582,2595],{"slug":2515,"name":2515,"fn":2516,"description":2517,"org":2518,"tags":2519,"stars":25,"repoUrl":26,"updatedAt":2525},"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},[2520,2521,2524],{"name":17,"slug":18,"type":15},{"name":2522,"slug":2523,"type":15},"Monitoring","monitoring",{"name":13,"slug":14,"type":15},"2026-07-12T07:57:18.753533",{"slug":2527,"name":2527,"fn":2528,"description":2529,"org":2530,"tags":2531,"stars":25,"repoUrl":26,"updatedAt":2538},"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},[2532,2535,2536,2537],{"name":2533,"slug":2534,"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":2540,"name":2540,"fn":2541,"description":2542,"org":2543,"tags":2544,"stars":25,"repoUrl":26,"updatedAt":2555},"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},[2545,2548,2551,2552],{"name":2546,"slug":2547,"type":15},"Audit","audit",{"name":2549,"slug":2550,"type":15},"Compliance","compliance",{"name":17,"slug":18,"type":15},{"name":2553,"slug":2554,"type":15},"Security","security","2026-07-18T05:48:00.862384",{"slug":2557,"name":2557,"fn":2558,"description":2559,"org":2560,"tags":2561,"stars":25,"repoUrl":26,"updatedAt":2568},"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},[2562,2563,2564,2567],{"name":2546,"slug":2547,"type":15},{"name":17,"slug":18,"type":15},{"name":2565,"slug":2566,"type":15},"Operations","operations",{"name":2553,"slug":2554,"type":15},"2026-07-12T07:57:01.506735",{"slug":2570,"name":2570,"fn":2571,"description":2572,"org":2573,"tags":2574,"stars":25,"repoUrl":26,"updatedAt":2581},"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},[2575,2576,2579,2580],{"name":2546,"slug":2547,"type":15},{"name":2577,"slug":2578,"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":2583,"name":2583,"fn":2584,"description":2585,"org":2586,"tags":2587,"stars":25,"repoUrl":26,"updatedAt":2594},"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},[2588,2589,2592,2593],{"name":17,"slug":18,"type":15},{"name":2590,"slug":2591,"type":15},"Engineering","engineering",{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},"2026-07-12T07:57:26.543278",{"slug":2596,"name":2596,"fn":2597,"description":2598,"org":2599,"tags":2600,"stars":25,"repoUrl":26,"updatedAt":2604},"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},[2601,2602,2603],{"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":2607,"total":2725},[2608,2625,2639,2652,2663,2673,2684,2690,2697,2704,2711,2718],{"slug":2609,"name":2609,"fn":2610,"description":2611,"org":2612,"tags":2613,"stars":2622,"repoUrl":2623,"updatedAt":2624},"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},[2614,2615,2618,2621],{"name":17,"slug":18,"type":15},{"name":2616,"slug":2617,"type":15},"Incident Response","incident-response",{"name":2619,"slug":2620,"type":15},"Kubernetes","kubernetes",{"name":2522,"slug":2523,"type":15},105,"https:\u002F\u002Fgithub.com\u002Fcockroachdb\u002Fhelm-charts","2026-07-12T07:57:25.288146",{"slug":2626,"name":2626,"fn":2627,"description":2628,"org":2629,"tags":2630,"stars":2622,"repoUrl":2623,"updatedAt":2638},"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},[2631,2634,2637],{"name":2632,"slug":2633,"type":15},"Deployment","deployment",{"name":2635,"slug":2636,"type":15},"Encryption","encryption",{"name":2553,"slug":2554,"type":15},"2026-07-12T07:56:37.675396",{"slug":2640,"name":2640,"fn":2641,"description":2642,"org":2643,"tags":2644,"stars":2622,"repoUrl":2623,"updatedAt":2651},"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},[2645,2646,2647,2648],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":2619,"slug":2620,"type":15},{"name":2649,"slug":2650,"type":15},"Migration","migration","2026-07-12T07:56:48.360871",{"slug":2653,"name":2653,"fn":2654,"description":2655,"org":2656,"tags":2657,"stars":2622,"repoUrl":2623,"updatedAt":2662},"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},[2658,2659,2660,2661],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":2632,"slug":2633,"type":15},{"name":2619,"slug":2620,"type":15},"2026-07-12T07:57:24.018818",{"slug":2664,"name":2664,"fn":2665,"description":2666,"org":2667,"tags":2668,"stars":2622,"repoUrl":2623,"updatedAt":2672},"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},[2669,2670,2671],{"name":17,"slug":18,"type":15},{"name":2632,"slug":2633,"type":15},{"name":2619,"slug":2620,"type":15},"2026-07-12T07:56:45.777567",{"slug":2674,"name":2674,"fn":2675,"description":2676,"org":2677,"tags":2678,"stars":2622,"repoUrl":2623,"updatedAt":2683},"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},[2679,2680,2681,2682],{"name":17,"slug":18,"type":15},{"name":2632,"slug":2633,"type":15},{"name":2619,"slug":2620,"type":15},{"name":2565,"slug":2566,"type":15},"2026-07-12T07:56:47.082609",{"slug":2515,"name":2515,"fn":2516,"description":2517,"org":2685,"tags":2686,"stars":25,"repoUrl":26,"updatedAt":2525},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2687,2688,2689],{"name":17,"slug":18,"type":15},{"name":2522,"slug":2523,"type":15},{"name":13,"slug":14,"type":15},{"slug":2527,"name":2527,"fn":2528,"description":2529,"org":2691,"tags":2692,"stars":25,"repoUrl":26,"updatedAt":2538},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2693,2694,2695,2696],{"name":2533,"slug":2534,"type":15},{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},{"slug":2540,"name":2540,"fn":2541,"description":2542,"org":2698,"tags":2699,"stars":25,"repoUrl":26,"updatedAt":2555},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2700,2701,2702,2703],{"name":2546,"slug":2547,"type":15},{"name":2549,"slug":2550,"type":15},{"name":17,"slug":18,"type":15},{"name":2553,"slug":2554,"type":15},{"slug":2557,"name":2557,"fn":2558,"description":2559,"org":2705,"tags":2706,"stars":25,"repoUrl":26,"updatedAt":2568},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2707,2708,2709,2710],{"name":2546,"slug":2547,"type":15},{"name":17,"slug":18,"type":15},{"name":2565,"slug":2566,"type":15},{"name":2553,"slug":2554,"type":15},{"slug":2570,"name":2570,"fn":2571,"description":2572,"org":2712,"tags":2713,"stars":25,"repoUrl":26,"updatedAt":2581},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2714,2715,2716,2717],{"name":2546,"slug":2547,"type":15},{"name":2577,"slug":2578,"type":15},{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"slug":2583,"name":2583,"fn":2584,"description":2585,"org":2719,"tags":2720,"stars":25,"repoUrl":26,"updatedAt":2594},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2721,2722,2723,2724],{"name":17,"slug":18,"type":15},{"name":2590,"slug":2591,"type":15},{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},40]