Database Performance Tuning and Scaling Questions
System-level performance work beyond a single query: configuration and resource tuning, capacity planning, handling large data volumes, and scaling read and write throughput. Covers identifying bottlenecks, growth management, and the vertical-versus-horizontal scaling decision. Tests whether a candidate can keep a database healthy as load grows.
When are materialized views helpful versus regular views? For a dashboard that needs aggregates over 30 days across millions of rows with near-real-time accuracy requirements, propose a materialized view refresh strategy and explain refresh modes and locks impact.
Denormalization at scale can improve read performance but introduces write amplification and complexity. Propose a hybrid pattern that balances normalization and denormalized read tables for reporting, including ETL patterns (CDC, streaming) to keep denormalized stores consistent and validated.
A multi-tenant reporting system shows hot shards for a few large tenants, causing uneven load. Propose a sharding key and strategy to distribute load more evenly across nodes while minimizing cross-shard joins. Include an approach for migrating existing data with minimal downtime.
Design an analytical dashboard backend to support 100k concurrent users and fast lookups on 10B rows. Specify data storage (columnar vs relational), caching layers, pre-aggregation strategies, and how you would architect read replicas or query engines (e.g., BI accelerators). Include cost vs latency trade-offs.
Rewrite the following GROUP BY query using window functions or more efficient aggregation techniques to improve performance for monthly user retention calculation. Explain why your rewrite is more efficient and whether it will take advantage of indexes:
SELECT user_id, COUNT(*) AS months_active
FROM user_events
WHERE event_date >= '2023-01-01'
GROUP BY user_id;
Unlock Full Question Bank
Get access to all 45 Database Performance Tuning and Scaling interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.