Master advanced CockroachDB 24.3 performance optimization through memory, CPU, storage, and query tuning. Configure cluster parameters, connection pooling, and indexing strategies for production-grade distributed SQL workloads.
Prerequisites
- Existing CockroachDB 24.3 cluster
- Root or sudo access
- At least 8GB RAM per node
- SSD storage recommended
What this solves
CockroachDB performance optimization requires careful tuning of memory allocation, CPU utilization, storage I/O, and query execution patterns. This tutorial covers advanced configuration techniques to maximize throughput, reduce latency, and ensure optimal resource utilization in production CockroachDB 24.3 clusters.
Prerequisites and system requirements
Verify CockroachDB installation
Confirm you have CockroachDB 24.3 installed and running. This tutorial builds on an existing cluster setup.
cockroach version
sudo systemctl status cockroach
Install performance monitoring tools
Install system monitoring utilities to measure performance improvements throughout the tuning process.
sudo apt update
sudo apt install -y htop iotop sysstat postgresql-client
Memory and CPU optimization
Configure cluster cache settings
Adjust CockroachDB cache sizes to optimize memory utilization. The cache size should typically be 25-35% of available system RAM.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = true;
SET CLUSTER SETTING sql.stats.histogram_collection.enabled = true;
SET CLUSTER SETTING kv.range_merge.queue_interval = '1m';
SET CLUSTER SETTING kv.snapshot_rebalance.max_rate = '32MiB';
"
Optimize memory pool allocation
Configure SQL memory pool and query execution memory limits to prevent out-of-memory conditions while maximizing performance.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.distsql.max_running_flows = 500;
SET CLUSTER SETTING sql.conn.max_read_buffer_message_size = '16MiB';
SET CLUSTER SETTING sql.metrics.statement_details.threshold = '1ms';
SET CLUSTER SETTING sql.metrics.statement_details.plan_collection.enabled = true;
"
Configure CPU and goroutine settings
Adjust concurrent operations and goroutine limits based on available CPU cores. Set these values to 2-4x the number of CPU cores.
cockroach sql --insecure --execute="
SET CLUSTER SETTING kv.snapshot_recovery.max_rate = '64MiB';
SET CLUSTER SETTING kv.bulk_io_write.concurrent_export_requests = 8;
SET CLUSTER SETTING kv.bulk_io_write.concurrent_addsstable_requests = 8;
SET CLUSTER SETTING sql.distsql.distribute_index_joins = true;
"
Update systemd service configuration
Modify the systemd service file to include optimized startup parameters for memory and CPU usage.
[Unit]
Description=Cockroach Database cluster node
Requires=network.target
[Service]
Type=notify
WorkingDirectory=/var/lib/cockroach
ExecStart=/usr/local/bin/cockroach start \
--insecure \
--store=path=/var/lib/cockroach \
--listen-addr=0.0.0.0:26257 \
--http-addr=0.0.0.0:8080 \
--join=203.0.113.10:26257,203.0.113.11:26257,203.0.113.12:26257 \
--cache=2GiB \
--max-sql-memory=4GiB
TimeoutStopSec=60
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cockroach
User=cockroach
[Install]
WantedBy=default.target
Reload systemd and restart CockroachDB
Apply the new configuration by reloading systemd and restarting the CockroachDB service.
sudo systemctl daemon-reload
sudo systemctl restart cockroach
sudo systemctl status cockroach
Storage and I/O performance tuning
Configure storage layer settings
Optimize RocksDB settings for better write performance and compaction behavior. These settings reduce write amplification and improve throughput.
cockroach sql --insecure --execute="
SET CLUSTER SETTING rocksdb.min_wal_sync_interval = '500us';
SET CLUSTER SETTING kv.range_split.by_load_threshold = 2500;
SET CLUSTER SETTING kv.range_split.load_qps_threshold = 2500;
SET CLUSTER SETTING storage.max_sync_duration = '20s';
"
Optimize write batch settings
Configure batch write operations and WAL sync intervals to balance durability with performance for your specific workload.
cockroach sql --insecure --execute="
SET CLUSTER SETTING kv.raft.command.max_size = '64MiB';
SET CLUSTER SETTING kv.transaction.write_pipelining_enabled = true;
SET CLUSTER SETTING kv.range_merge.queue_enabled = true;
SET CLUSTER SETTING storage.mvcc.range_tombstones.enabled = true;
"
Configure compaction and garbage collection
Tune RocksDB compaction and CockroachDB garbage collection settings to maintain optimal read performance over time.
cockroach sql --insecure --execute="
SET CLUSTER SETTING kv.gc.ttlseconds = 90000;
SET CLUSTER SETTING kv.closed_timestamp.target_duration = '3s';
SET CLUSTER SETTING kv.protectedts.poll_interval = '3m';
SET CLUSTER SETTING storage.mvcc.range_tombstones.enabled = true;
"
Optimize filesystem and mount options
Configure optimal mount options for CockroachDB data directories to improve I/O performance.
sudo umount /var/lib/cockroach
sudo mount -t ext4 -o noatime,data=writeback,barrier=0,nobh /dev/sdb1 /var/lib/cockroach
sudo chown -R cockroach:cockroach /var/lib/cockroach
Update fstab for persistent mount options
Make filesystem optimization permanent by updating the fstab configuration.
/dev/sdb1 /var/lib/cockroach ext4 noatime,data=writeback,barrier=0,nobh 0 2
Network and connection pool optimization
Configure connection pool settings
Optimize connection pooling parameters to handle high-concurrency workloads efficiently while preventing connection exhaustion.
cockroach sql --insecure --execute="
SET CLUSTER SETTING server.host_based_authentication.configuration = '
host all all all cert-password
';
SET CLUSTER SETTING sql.conn.max_read_buffer_message_size = '16MiB';
SET CLUSTER SETTING server.shutdown.drain_wait = '5m';
"
Implement connection pooling with PgBouncer
Set up PgBouncer as a connection pooler to reduce connection overhead and improve application scalability. For detailed setup, see our CockroachDB connection pooling guide.
sudo apt install -y pgbouncer
Configure PgBouncer for CockroachDB
Create an optimized PgBouncer configuration that works with CockroachDB's connection requirements.
[databases]
cockroachdb = host=127.0.0.1 port=26257 dbname=defaultdb
[pgbouncer]
listen_port = 5432
listen_addr = 127.0.0.1
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt
logfile = /var/log/postgresql/pgbouncer.log
pidfile = /var/run/postgresql/pgbouncer.pid
pool_mode = transaction
max_client_conn = 1000
default_pool_size = 100
min_pool_size = 10
reserve_pool_size = 10
max_db_connections = 200
server_reset_query = DISCARD ALL
server_check_delay = 30
Optimize network buffer settings
Configure TCP buffer sizes and network timeouts for optimal cluster communication performance.
cockroach sql --insecure --execute="
SET CLUSTER SETTING cluster.preserve_downgrade_option = '';
SET CLUSTER SETTING kv.raft.election_timeout = '3s';
SET CLUSTER SETTING kv.raft.heartbeat_interval = '1s';
SET CLUSTER SETTING kv.lease_rebalancing_aggressiveness = 1.0;
"
Configure kernel network parameters
Optimize Linux kernel network settings to handle high-throughput database connections efficiently.
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 16384 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.core.netdev_max_backlog = 2500
net.ipv4.tcp_no_delay = 1
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_congestion_control = bbr
Apply kernel parameter changes
Load the new network configuration and verify the changes are applied correctly.
sudo sysctl --system
sudo sysctl net.ipv4.tcp_congestion_control
sudo sysctl net.core.rmem_max
Query optimization and indexing strategies
Enable advanced query optimization
Configure CockroachDB's cost-based optimizer and enable advanced query optimization features for better execution plans.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = true;
SET CLUSTER SETTING sql.stats.histogram_collection.enabled = true;
SET CLUSTER SETTING sql.optimizer.use_histograms.enabled = true;
SET CLUSTER SETTING sql.optimizer.use_multicol_stats.enabled = true;
"
Configure query execution settings
Optimize distributed query execution and enable advanced join algorithms for complex queries.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.distsql.distribute_index_joins = true;
SET CLUSTER SETTING sql.optimizer.locality_optimized_partitioned_index_scan.enabled = true;
SET CLUSTER SETTING sql.optimizer.partial_index.enabled = true;
SET CLUSTER SETTING sql.optimizer.foreign_key.enabled = true;
"
Create performance monitoring views
Set up monitoring queries to track slow queries and identify optimization opportunities.
cockroach sql --insecure --execute="
CREATE VIEW slow_queries AS
SELECT
aggregated_ts,
fingerprint_id,
app_name,
metadata ->> 'query' as query_text,
statistics -> 'statistics' -> 'cnt' as execution_count,
statistics -> 'statistics' -> 'meanLatency' as mean_latency
FROM crdb_internal.statement_statistics
WHERE (statistics -> 'statistics' -> 'meanLatency')::FLOAT > 0.1
ORDER BY (statistics -> 'statistics' -> 'meanLatency')::FLOAT DESC;
"
Implement automatic statistics collection
Configure automatic table statistics collection to ensure the query optimizer has accurate data for generating efficient execution plans.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.stats.automatic_collection.fraction_stale_rows = 0.2;
SET CLUSTER SETTING sql.stats.automatic_collection.min_stale_rows = 500;
SET CLUSTER SETTING sql.stats.forecasts.enabled = true;
SET CLUSTER SETTING sql.stats.forecasts.min_observations = 5;
"
Configure index usage optimization
Enable features that help CockroachDB make better decisions about index selection and usage patterns.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.optimizer.index_recommendations.enabled = true;
SET CLUSTER SETTING sql.optimizer.use_not_visible_indexes.enabled = false;
SET CLUSTER SETTING sql.optimizer.join_elimination.enabled = true;
SET CLUSTER SETTING sql.optimizer.memo.max_group_size_factor = 10000;
"
Set up query plan caching
Configure prepared statement and query plan caching to reduce planning overhead for frequently executed queries.
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.prepare.cached_plan_removal.fraction = 0.5;
SET CLUSTER SETTING sql.optimizer.plan_cache.enabled = true;
SET CLUSTER SETTING sql.optimizer.plan_cache.size = 1000;
SET CLUSTER SETTING sql.optimizer.memo.max_size_factor = 1000;
"
Advanced indexing strategies
Create optimized indexes for common query patterns
Design and create indexes that support your most frequent query patterns while minimizing storage overhead.
cockroach sql --insecure --execute="
-- Create a sample table for demonstration
CREATE TABLE IF NOT EXISTS user_activity (
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
activity_timestamp TIMESTAMPTZ NOT NULL DEFAULT now(),
activity_type STRING NOT NULL,
session_id UUID NOT NULL,
metadata JSONB
);
-- Create covering index for time-based queries
CREATE INDEX idx_activity_time_covering
ON user_activity (activity_timestamp DESC)
STORING (activity_type, session_id, metadata);
-- Create partial index for active sessions
CREATE INDEX idx_active_sessions
ON user_activity (session_id, activity_timestamp)
WHERE activity_timestamp > now() - INTERVAL '24 hours';
"
Implement inverted indexes for JSON data
Create inverted indexes on JSONB columns to enable efficient queries on JSON document contents.
cockroach sql --insecure --execute="
-- Create inverted index for JSON queries
CREATE INVERTED INDEX idx_metadata_gin ON user_activity (metadata);
-- Create expression index for JSON path queries
CREATE INDEX idx_metadata_type ON user_activity ((metadata->>'type')) WHERE metadata ? 'type';
"
Monitor index usage and effectiveness
Create monitoring queries to track index usage statistics and identify unused or inefficient indexes.
cockroach sql --insecure --execute="
SELECT
schemaname,
tablename,
indexname,
num_reads,
last_read
FROM crdb_internal.index_usage_statistics
ORDER BY num_reads DESC;
"
Monitoring and performance validation
Set up comprehensive monitoring
Configure monitoring to track the impact of your performance optimizations. Consider implementing automated performance monitoring.
cockroach sql --insecure --execute="
SELECT
node_id,
store_id,
capacity,
available,
used,
(used::FLOAT / capacity::FLOAT * 100)::INT as used_percent
FROM crdb_internal.kv_store_status;
"
Create performance baseline metrics
Establish baseline performance metrics to measure the effectiveness of your tuning efforts.
cockroach workload init tpcc 'postgresql://root@localhost:26257?sslmode=disable'
cockroach workload run tpcc --duration=5m --concurrency=10 'postgresql://root@localhost:26257?sslmode=disable'
Verify your setup
# Check cluster status
cockroach node status --insecure
Verify configuration changes
cockroach sql --insecure --execute="SHOW CLUSTER SETTINGS WHERE setting LIKE '%cache%';"
Monitor query performance
cockroach sql --insecure --execute="SELECT * FROM slow_queries LIMIT 10;"
Check system resource usage
htop
iotop -ao
Common issues
| Symptom | Cause | Fix |
|---|---|---|
| High memory usage after tuning | Cache settings too aggressive | Reduce cache size to 25% of RAM: --cache=2GiB |
| Slow writes after I/O optimization | Disabled write barriers reducing durability | Re-enable barriers: mount -o remount,barrier /var/lib/cockroach |
| Connection pool exhaustion | PgBouncer pool size too small | Increase default_pool_size and max_db_connections |
| Query optimizer not using new indexes | Statistics not updated | Force statistics collection: ANALYZE TABLE table_name; |
| Network timeouts in cluster | Network buffers insufficient | Increase TCP buffer sizes in sysctl configuration |
Next steps
- Set up comprehensive system monitoring with sar and sysstat
- Learn connection pooling concepts with MariaDB and ProxySQL
- Configure CockroachDB multi-region deployment for geographic distribution
- Set up automated CockroachDB backup strategies
- Implement CockroachDB security hardening with certificate authentication
Automated install script
Run this to automate the entire setup
#!/usr/bin/env bash
set -euo pipefail
# CockroachDB 24.3 Performance Optimization Script
# Optimizes memory, CPU, storage, and query performance settings
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Global variables
COCKROACH_USER="cockroach"
COCKROACH_SERVICE="cockroach"
SYSTEM_RAM_GB=""
CPU_CORES=""
# Usage function
usage() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --cache-size SIZE Cache size (default: auto-detected based on RAM)"
echo " --max-sql-memory SIZE Max SQL memory (default: auto-detected)"
echo " --join-addresses ADDRS Comma-separated list of cluster addresses"
echo " --help Show this help message"
exit 1
}
# Error handling
cleanup() {
echo -e "${RED}[ERROR] Script failed. Check logs above for details.${NC}"
exit 1
}
trap cleanup ERR
# Parse arguments
CACHE_SIZE=""
MAX_SQL_MEMORY=""
JOIN_ADDRESSES=""
while [[ $# -gt 0 ]]; do
case $1 in
--cache-size)
CACHE_SIZE="$2"
shift 2
;;
--max-sql-memory)
MAX_SQL_MEMORY="$2"
shift 2
;;
--join-addresses)
JOIN_ADDRESSES="$2"
shift 2
;;
--help)
usage
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
usage
;;
esac
done
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}This script must be run as root${NC}"
exit 1
fi
# Detect distribution
echo "[1/8] Detecting distribution..."
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
ubuntu|debian)
PKG_MGR="apt"
PKG_UPDATE="apt update"
PKG_INSTALL="apt install -y"
POSTGRES_CLIENT="postgresql-client"
;;
almalinux|rocky|centos|rhel|ol|fedora)
PKG_MGR="dnf"
PKG_UPDATE="dnf makecache"
PKG_INSTALL="dnf install -y"
POSTGRES_CLIENT="postgresql"
;;
amzn)
PKG_MGR="yum"
PKG_UPDATE="yum makecache"
PKG_INSTALL="yum install -y"
POSTGRES_CLIENT="postgresql"
;;
*)
echo -e "${RED}Unsupported distribution: $ID${NC}"
exit 1
;;
esac
echo -e "${GREEN}Detected: $PRETTY_NAME${NC}"
else
echo -e "${RED}Cannot detect distribution${NC}"
exit 1
fi
# Verify CockroachDB installation
echo "[2/8] Verifying CockroachDB installation..."
if ! command -v cockroach &> /dev/null; then
echo -e "${RED}CockroachDB not found. Please install CockroachDB 24.3 first.${NC}"
exit 1
fi
COCKROACH_VERSION=$(cockroach version 2>/dev/null | grep "Build Tag" | awk '{print $3}' || echo "unknown")
echo -e "${GREEN}CockroachDB version: $COCKROACH_VERSION${NC}"
# Check if CockroachDB service exists
if ! systemctl list-unit-files | grep -q "$COCKROACH_SERVICE.service"; then
echo -e "${YELLOW}Warning: CockroachDB systemd service not found. Performance tuning will continue but service restart will be skipped.${NC}"
fi
# Install performance monitoring tools
echo "[3/8] Installing performance monitoring tools..."
$PKG_UPDATE > /dev/null 2>&1
$PKG_INSTALL htop iotop sysstat $POSTGRES_CLIENT
# Detect system resources
echo "[4/8] Detecting system resources..."
SYSTEM_RAM_GB=$(free -g | awk 'NR==2{printf "%.0f", $2}')
CPU_CORES=$(nproc)
echo -e "${GREEN}System RAM: ${SYSTEM_RAM_GB}GB${NC}"
echo -e "${GREEN}CPU Cores: ${CPU_CORES}${NC}"
# Calculate optimal cache and memory settings if not provided
if [[ -z "$CACHE_SIZE" ]]; then
CACHE_SIZE_GB=$((SYSTEM_RAM_GB * 30 / 100))
if [[ $CACHE_SIZE_GB -lt 1 ]]; then
CACHE_SIZE_GB=1
fi
CACHE_SIZE="${CACHE_SIZE_GB}GiB"
fi
if [[ -z "$MAX_SQL_MEMORY" ]]; then
MAX_SQL_MEMORY_GB=$((SYSTEM_RAM_GB * 25 / 100))
if [[ $MAX_SQL_MEMORY_GB -lt 1 ]]; then
MAX_SQL_MEMORY_GB=1
fi
MAX_SQL_MEMORY="${MAX_SQL_MEMORY_GB}GiB"
fi
echo -e "${GREEN}Cache size: $CACHE_SIZE${NC}"
echo -e "${GREEN}Max SQL memory: $MAX_SQL_MEMORY${NC}"
# Configure cluster cache and statistics settings
echo "[5/8] Configuring cluster cache and statistics settings..."
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = true;
SET CLUSTER SETTING sql.stats.histogram_collection.enabled = true;
SET CLUSTER SETTING kv.range_merge.queue_interval = '1m';
SET CLUSTER SETTING kv.snapshot_rebalance.max_rate = '32MiB';" 2>/dev/null || echo -e "${YELLOW}Warning: Could not configure some cluster settings. Ensure CockroachDB is running and accessible.${NC}"
# Optimize memory pool allocation
echo "[6/8] Optimizing memory pool allocation..."
cockroach sql --insecure --execute="
SET CLUSTER SETTING sql.distsql.max_running_flows = 500;
SET CLUSTER SETTING sql.conn.max_read_buffer_message_size = '16MiB';
SET CLUSTER SETTING sql.metrics.statement_details.threshold = '1ms';
SET CLUSTER SETTING sql.metrics.statement_details.plan_collection.enabled = true;" 2>/dev/null || echo -e "${YELLOW}Warning: Could not configure memory settings.${NC}"
# Configure CPU and goroutine settings
BULK_CONCURRENT_REQUESTS=$((CPU_CORES * 2))
if [[ $BULK_CONCURRENT_REQUESTS -lt 4 ]]; then
BULK_CONCURRENT_REQUESTS=4
fi
cockroach sql --insecure --execute="
SET CLUSTER SETTING kv.snapshot_recovery.max_rate = '64MiB';
SET CLUSTER SETTING kv.bulk_io_write.concurrent_export_requests = $BULK_CONCURRENT_REQUESTS;
SET CLUSTER SETTING kv.bulk_io_write.concurrent_addsstable_requests = $BULK_CONCURRENT_REQUESTS;
SET CLUSTER SETTING sql.distsql.distribute_index_joins = true;" 2>/dev/null || echo -e "${YELLOW}Warning: Could not configure CPU settings.${NC}"
# Configure storage layer settings
cockroach sql --insecure --execute="
SET CLUSTER SETTING rocksdb.min_wal_sync_interval = '500us';
SET CLUSTER SETTING kv.range_split.by_load_threshold = 2500;
SET CLUSTER SETTING kv.range_split.load_qps_threshold = 2500;
SET CLUSTER SETTING storage.max_sync_duration = '20s';" 2>/dev/null || echo -e "${YELLOW}Warning: Could not configure storage settings.${NC}"
# Optimize write batch settings
cockroach sql --insecure --execute="
SET CLUSTER SETTING kv.raft.command.max_size = '64MiB';
SET CLUSTER SETTING kv.transaction.write_pipelining_enabled = true;" 2>/dev/null || echo -e "${YELLOW}Warning: Could not configure write batch settings.${NC}"
# Update systemd service configuration if service exists
echo "[7/8] Updating systemd service configuration..."
SERVICE_FILE="/etc/systemd/system/$COCKROACH_SERVICE.service"
if [[ -f "$SERVICE_FILE" ]]; then
# Backup existing service file
cp "$SERVICE_FILE" "${SERVICE_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
# Create optimized service file
cat > "$SERVICE_FILE" << EOF
[Unit]
Description=Cockroach Database cluster node
Requires=network.target
[Service]
Type=notify
WorkingDirectory=/var/lib/cockroach
ExecStart=/usr/local/bin/cockroach start \\
--insecure \\
--store=path=/var/lib/cockroach \\
--listen-addr=0.0.0.0:26257 \\
--http-addr=0.0.0.0:8080 \\
EOF
if [[ -n "$JOIN_ADDRESSES" ]]; then
echo " --join=$JOIN_ADDRESSES \\" >> "$SERVICE_FILE"
fi
cat >> "$SERVICE_FILE" << EOF
--cache=$CACHE_SIZE \\
--max-sql-memory=$MAX_SQL_MEMORY
TimeoutStopSec=60
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cockroach
User=$COCKROACH_USER
[Install]
WantedBy=default.target
EOF
chown root:root "$SERVICE_FILE"
chmod 644 "$SERVICE_FILE"
# Reload systemd and restart service
systemctl daemon-reload
if systemctl is-active --quiet "$COCKROACH_SERVICE"; then
echo -e "${YELLOW}Restarting CockroachDB service...${NC}"
systemctl restart "$COCKROACH_SERVICE"
sleep 5
fi
systemctl status "$COCKROACH_SERVICE" --no-pager || echo -e "${YELLOW}Service status check failed.${NC}"
else
echo -e "${YELLOW}Service file not found. Skipping systemd configuration.${NC}"
fi
# Verification and final status
echo "[8/8] Verifying configuration..."
echo -e "${GREEN}Performance optimization completed successfully!${NC}"
echo
echo "Configuration Summary:"
echo " Cache Size: $CACHE_SIZE"
echo " Max SQL Memory: $MAX_SQL_MEMORY"
echo " CPU Cores: $CPU_CORES"
echo " System RAM: ${SYSTEM_RAM_GB}GB"
echo
echo "Next steps:"
echo "1. Monitor performance using: htop, iotop, or CockroachDB Web UI (port 8080)"
echo "2. Check cluster status: cockroach node status --insecure"
echo "3. Review query performance: Access Web UI at http://localhost:8080"
echo
echo -e "${GREEN}CockroachDB performance optimization complete!${NC}"
Review the script before running. Execute with: bash install.sh