This feature is in and subject to change. To share feedback and/or issues, contact Support.
How ASH sampling works
ASH captures point-in-time snapshots of each ’s active work by sampling cluster activity at regular intervals (determined by theobs.ash.sample_interval cluster setting). At each sample point, ASH examines all goroutines that are actively executing or waiting, and it records what each one is doing. Each sample captures details like the workload that the goroutine belongs to (statement fingerprint, job ID, or system task) and the activity the goroutine is occupied with. These samples fill an in-memory circular ring buffer, the size of which is determined by the obs.ash.buffer_size cluster setting. When the buffer fills, the oldest samples are overwritten. Samples do not persist on disk. They are lost on node restart.
A user can query the ASH data for the specific node to which their SQL shell is connected (the gateway node) or across the whole cluster.
Because ASH is sampling-based rather than event-based, the sample count for a particular activity is proportional to how much time was spent on that activity. For example, if a query appears in 45 out of 60 sample points over one minute, it was actively consuming resources for approximately 45 seconds of that minute. This approach provides an accurate picture of resource usage patterns over time, but it means that short-lived operations completed between sampling points may not be captured. To troubleshoot very brief operations, you may need to reduce the obs.ash.sample_interval , or use statement diagnostics. However, use caution when reducing the sampling interval, as this will cause the buffer to fill up quickly.
ASH does not provide exact resource accounting per query or job, nor does it provide the exact timing of individual executions. Its sampling-based approach instead provides a statistically reliable view of the system at a given time, which can help with troubleshooting.
These point-in-time samples can be used to:
- Root-cause slow queries: Understand exactly what a query was doing at specific points in time (e.g., , performing I/O, consuming CPU).
- Identify bottlenecks: Determine which resources (CPU, locks, I/O, network, admission control) are constraining workload performance.
- Troubleshoot transient issues: Diagnose performance problems that don’t show up in aggregated statistics because they’re intermittent or short-lived.
- Analyze resource usage patterns: Understand how different workloads (user queries, , system operations) consume cluster resources.
- Compare performance across time: Analyze how workload behavior changes during different time periods (e.g., peak vs. off-peak hours).
Use ASH alongside other monitoring tools
ASH complements CockroachDB’s existing observability tools. Each tool serves a different purpose:
ASH can often be used with these other tools to help troubleshoot issues. For example, Prometheus metrics might alert you to a problem (such as a CPU spike at 2:15 PM). ASH shows which queries and jobs were actively running during that spike and which took a disproportionate amount of time to run. The Statements Page then provides aggregated performance data for those queries over a longer period of time, and statement diagnostics give detailed execution plans for deeper analysis.
Configuration
The following configure ASH behavior:ASH table reference
ASH data is accessible through two views in the system catalog:- : Includes samples from the gateway node.
- : Includes samples from all nodes in the cluster. Querying the cluster-wide view may be more resource-intensive for large clusters.
workload columns
Each sample is attributed to a workload via the workload_type and workload_id columns. The encoding of workload_id depends on the workload_type:
work_event columns
The work_event_type categorizes the resource being consumed or waited on. Types include CPU, IO, LOCK, NETWORK, ADMISSION, and OTHER. The work_event gives the specific activity.
CPU
work_events whose work_event_type is CPU represent active computation:
IO
work_events whose work_event_type is IO represent storage I/O:
LOCK
work_events whose work_event_type is LOCK represent lock and latch contention:
NETWORK
work_events whose work_event_type is NETWORK represent remote RPCs:
ADMISSION
work_events whose work_event_type is ADMISSION represent admission control queues:
OTHER
work_events whose work_event_type is OTHER represent miscellaneous wait points:
Debug zip integration
When the environment sampler triggers or , ASH writes aggregated report files (.txt and .json) alongside them. These reports are included in output. The naming pattern for these files is as follows:
TIMESTAMP: When the report was made (formatted as2006-01-02T15_04_05.000)TRIGGER: What event triggered the report (goroutine_dumporcpu_profile)FORMAT:.txt(human-readable) or.json(structured)
ash_report.2026-03-05T12_00_00.000.goroutine_dump.txt
The lookback window for these reports is controlled by the obs.ash.log_interval cluster setting.
Common use cases and examples
ASH is accessed through the built-in CockroachDB SQL shell. Run to open the shell. CockroachDB Cloud deployments can also use the on the Console.Enable Active Session History
To enable ASH on your cluster:View a node’s work event data from the past minute
Scenario: A node is experiencing high resource utilization, but it’s unclear which subsystem (CPU, I/O, locks, network) is consuming resources and what specific operations are involved. You can query the node-level ASH view to see what resources the node has been consuming:DistSenderRemote) and Raft consensus waits (RaftProposalWait), which is typical for write-heavy workloads that must replicate data across nodes. The upsert CPU samples show time spent executing upsert statements, while ReplicationFlowControl admission samples indicate that the system is throttling writes due to replication backpressure. The LockWait samples indicate some on hot keys. To identify which specific workloads are causing these waits, add workload_type, workload_id, and app_name to the query and group by them.
View cluster-wide workload data from the past 10 minutes
Scenario: Overall cluster resource consumption is high, but it’s unclear which workloads (user queries, background jobs, or system tasks) are responsible for the activity. You can query the cluster-wide ASH view to identify the top workloads consuming resources across all nodes:9bef06d795045524) from the kv application is the largest consumer of cluster resources. System tasks like INTENT_RESOLUTION (async cleanup of transaction intents) and TXN_HEARTBEAT are also significant. To investigate the statement, use the workload_id to find the statement on the . To investigate the job, use its workload_id on the . CockroachDB Cloud users can use the and in the Cloud Console.
Find recent lock contention hotspots
Scenario: Elevated p99 latency and increased indicate contention, but it’s unclear which specific workloads are experiencing lock waits and what type of contention is occurring. You can filter ASH samples to show only lock-related wait events:workload_id to locate the query on the and examine its execution plan and contention time. Review the for contention insights on this statement. CockroachDB Cloud users can use the and in the Cloud Console. If multiple workloads show LockWait events, investigate whether they’re accessing the same tables or rows by examining their query patterns. For detailed contention analysis, see .
Get details about what a specific job is spending time on
Scenario: A background job (such as a , schema change, or ) is running longer than expected, but it’s unclear whether the job is consuming CPU, waiting on I/O, or blocked by other resources. You can filter by workload type and job ID to understand where the job is spending its time:SELECT job_id, description, status FROM [SHOW JOBS]. CockroachDB Cloud users can use the in the Cloud Console.
Known limitations
- ASH is not recommended for nodes with 64 or more vCPUs, due to degraded performance on those nodes.
- On Basic and Standard CockroachDB Cloud clusters, ASH samples only cover work running on the pod. KV-level work ( I/O, , , etc.) is not visible in ASH samples.
- KV work triggered during (for example, , proposals deferred from earlier statements in an ) is attributed to the last , not the statement that originally caused the work.

