InterviewStack.io LogoInterviewStack.io

Database Design and Query Optimization Questions

Principles of database schema design and performance optimization including relational and non relational trade offs, normalization and denormalization, indexing strategies and index types, clustered and non clustered indexes, query execution plans, common table expressions for readable complex queries, detecting missing or redundant indexes, sharding and partitioning strategies, and consistency and availability trade offs. Candidates should demonstrate knowledge of optimizing reads and writes, diagnosing slow queries, and selecting the appropriate database model for scale and consistency requirements.

MediumSystem Design
57 practiced
Design a table schema for an event tracking system that supports high write throughput and efficient analytics queries for daily dashboards. Include primary keys, suggested indexes, partitioning strategy, and a short justification of choices. Example events: user_id, event_type, properties JSON, occurred_at.
HardTechnical
46 practiced
Your analytics workloads run on a cloud-managed database with autoscaling. Costs have spiked due to heavy ad-hoc queries. Propose concrete optimizations at schema, query, and operational levels to reduce cloud spending while maintaining acceptable performance for analysts. Include cost-vs-latency trade-offs.
EasyTechnical
50 practiced
List the most common root causes of slow queries in analytic workloads and propose an ordered checklist of diagnostic steps you would run when a scheduled report suddenly starts taking much longer. Include quick checks you can run without admin privileges and deeper checks that require DBA access.
EasyTechnical
45 practiced
You suspect a database has missing useful indexes. As a data analyst, describe a step-by-step method to detect missing indexes using database metrics and query logs. What signals would you look for (e.g., long sequential scans, high CPU on certain queries), and how would you prioritize which missing indexes to create?
EasyTechnical
76 practiced
Explain database normalization and the first three normal forms (1NF, 2NF, 3NF). For each form: describe the rule, show a concise example of a violation in a customer-orders schema, and explain how you would correct it. As a data analyst, also explain situations where you would intentionally denormalize data for reporting and why.

Unlock Full Question Bank

Get access to hundreds of Database Design and Query Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.