Course contentsShow
← Databases & SQL
Lesson 1849 of 1,95317. Analytics and Data PipelinesFree lesson

Capacity Planning for Analytical Clusters

Scale compute resources based on observed workload patterns and concurrency demands.

In this lesson, you will learn how to proactively scale your analytical compute resources by mapping historical workload patterns to your cluster’s concurrency demands.

Scaling for Workload Patterns

In an analytical cluster, your compute resources—often measured in nodes, vCPUs, or "Data Warehouse Units"—should not be static. Over-provisioning leads to wasted spend, while under-provisioning causes queueing and slow query performance. To plan effectively, you must move beyond static allocation and implement dynamic scaling based on two primary dimensions: workload complexity and concurrency.

Observing Workload Patterns

Start by querying your audit logs (which you mastered in lesson 19) to extract query concurrency metrics. A common pattern is identifying "peak usage hours" by aggregating query counts over time.

SELECT 
    DATE_TRUNC('hour', start_time) AS observation_hour,
    COUNT(*) AS concurrent_queries,
    AVG(execution_time_ms) AS avg_latency
FROM query_execution_logs
WHERE start_time >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY 1
ORDER BY 1;

If your concurrent_queries consistently spikes at 9:00 AM every Monday, your capacity plan must trigger a compute scale-up event at 8:45 AM.

Mapping Concurrency to Compute

Analytical clusters generally process data in two ways:

  1. High Concurrency (Many small queries): Requires scaling out nodes to increase the total number of parallel execution slots.
  2. High Complexity (Massive joins/scans): Requires scaling up (larger node sizes) to handle memory-intensive operations like large-scale hash joins or sorting.

By analyzing the avg_latency relative to your cluster size, you can calculate the "tipping point" where latency degrades. For example, if you observe that latency increases exponentially once concurrency exceeds 50 sessions, your capacity threshold is set: when you reach 40 sessions, trigger an auto-scaling event to add compute resources to keep the cluster within the "optimal performance" window.

Capacity planning is about balancing the cost of compute (from lesson 22) against the latency requirements of your business users. By transforming historical log data into a predictive scaling schedule, you ensure your cluster remains performant without burning your budget.

Key Takeaway: Capacity planning requires using historical execution logs to identify the relationship between concurrent query load and latency, allowing you to automate resource scaling before bottlenecks occur.