A command-line tool that exports workload data from a CockroachDB cluster into a portable zip file for analysis and troubleshooting.
The workload-exporter creates a complete snapshot of your cluster's workload characteristics, including:
- Statement and transaction statistics - Query performance and execution patterns
- Contention events - Lock contention and blocking queries
- Cluster metadata - Version, configuration, and node topology
- Database schemas - Table structures and definitions
- Zone configurations - Replication and placement settings
- Table indexes - Index definitions and descriptor IDs
This data can be analyzed locally or shared with Cockroach Labs support for troubleshooting.
Download the latest release for your platform from the Releases Page, or use the commands below.
Set the version variable first, then run the command for your platform:
VERSION=v1.7.1 # replace with the desired release tagcurl -L "https://github.com/cockroachlabs/workload-exporter/releases/download/${VERSION}/workload-exporter-${VERSION}-darwin-arm64.tar.gz" | tar xz
mv "workload-exporter-${VERSION}-darwin-arm64" workload-exportercurl -L "https://github.com/cockroachlabs/workload-exporter/releases/download/${VERSION}/workload-exporter-${VERSION}-darwin-amd64.tar.gz" | tar xz
mv "workload-exporter-${VERSION}-darwin-amd64" workload-exportercurl -L "https://github.com/cockroachlabs/workload-exporter/releases/download/${VERSION}/workload-exporter-${VERSION}-linux-amd64.tar.gz" | tar xz
mv "workload-exporter-${VERSION}-linux-amd64" workload-exportercurl -L "https://github.com/cockroachlabs/workload-exporter/releases/download/${VERSION}/workload-exporter-${VERSION}-linux-arm64.tar.gz" | tar xz
mv "workload-exporter-${VERSION}-linux-arm64" workload-exporterDownload workload-exporter-${VERSION}-windows-amd64.zip from the releases page and extract it.
./workload-exporter versionUpdate to the latest release in-place:
./workload-exporter updateCheck if a newer version is available without installing:
./workload-exporter update --checkExport the last 2 hours of workload data (default):
./workload-exporter export \
-c "postgresql://user:password@host:26257/?sslmode=verify-full"This creates workload-export.zip in the current directory.
Export data for a specific time period:
./workload-exporter export \
-c "postgresql://user:password@host:26257/?sslmode=verify-full" \
-s "2025-04-18T13:00:00Z" \
-e "2025-04-18T20:00:00Z" \
-o "incident-export.zip"Flags:
-c, --connection-url string CockroachDB connection string (required)
-o, --output-file string Output zip file (default: "workload-export.zip")
-s, --start string Start time in RFC3339 format (default: 2 hours ago)
-e, --end string End time in RFC3339 format (default: 1 hour from now)
--debug Enable debug logging
postgresql://[user]:[password]@[host]:[port]/[database]?sslmode=[mode]
Example:
postgresql://admin:mypassword@my-cluster.example.com:26257/defaultdb?sslmode=verify-full
The export creates a zip file containing the following files:
metadata.json- Cluster version, ID, name, organization, and export configuration⚠️ Note: Connection string password is automatically redacted
crdb_internal.statement_statistics.csv- SQL statement execution statscrdb_internal.transaction_statistics.csv- Transaction execution statscrdb_internal.transaction_contention_events.csv- Lock contention eventscrdb_internal.gossip_nodes.csv- Node information and topologycrdb_internal.table_indexes.csv- Table and index descriptor IDs across all databases
Statistics files only include data within the specified time range
[database_name].schema.txt- CREATE statements for all tables in each database- One file per user database (system databases excluded)
zone_configurations.txt- All zone configuration SQL statements
The export is a standard zip file that you can inspect before sharing:
# List all files in the export
unzip -l workload-export.zip
# Extract to a directory
unzip workload-export.zip -d export-contents
# View the metadata
cat export-contents/metadata.json | jq .
# Preview statistics (first 10 lines)
head export-contents/crdb_internal.statement_statistics.csv
# Check what schemas were exported
ls export-contents/*.schema.txtAll data is in plain text format (JSON, CSV, SQL) and can be reviewed before sharing with Cockroach Labs or others.
- Passwords are redacted - Connection string passwords are automatically removed from metadata
- No query parameters - Statement statistics include query fingerprints, not actual parameter values
- Schema only - Table schemas are exported, but no actual table data is included
- Read-only - The tool only reads data and makes no modifications to your cluster
- Local export - All data is written to a local zip file under your control
- Verified updates -
workload-exporter updateverifies the SHA256 checksum of the downloaded binary against the checksums published with each GitHub release before installing
- CockroachDB version: 24.1 or later
- Network access to the CockroachDB cluster
- User permissions:
- Read access to
crdb_internaltables - Read access to system settings
- Read access to user databases (for schema export)
- Recommended: Admin role for simplest setup
- Read access to
For simplest setup, grant admin role:
GRANT admin TO your_user;For more restrictive permissions, see docs/TROUBLESHOOTING.md.
# Export data from when the issue occurred
./workload-exporter export \
-c "connection-string" \
-s "2025-04-18T14:00:00Z" \
-e "2025-04-18T16:00:00Z" \
-o "performance-issue.zip"# Export the last 24 hours
./workload-exporter export \
-c "connection-string" \
-s "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" \
-e "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "daily-$(date +%Y%m%d).zip"# Capture workload before a migration
./workload-exporter export \
-c "connection-string" \
-o "pre-migration-baseline.zip"See docs/TROUBLESHOOTING.md for solutions to common issues:
- Connection problems
- Permission errors
- Time format issues
- Empty exports
For detailed information about what the tool is doing:
./workload-exporter export -c "connection-string" --debug- Issues: GitHub Issues
- Cockroach Labs Support: Share the generated zip file with your support ticket
- Version Compatibility - Supported CockroachDB versions and version-specific behavior
- Troubleshooting Guide - Solutions to common issues
- Development Guide - Building from source and contributing
- Library Usage - Using workload-exporter as a Go library
- Testing Guide - Running tests and integration tests
Note: This tool is designed for CockroachDB clusters. For CockroachDB 26.1+, the tool automatically handles the required allow_unsafe_internals setting.