InterviewStack.io LogoInterviewStack.io

Data Modeling and Schema Design Questions

Designing relational schemas end to end: entity-relationship modeling, normal forms and deliberate denormalization, primary/foreign keys, data types, and integrity constraints, together with applied schema design driven by real business requirements and query access patterns. Covers modeling a domain from ambiguous requirements, choosing structures that serve the queries a system must run, trading normalization for correctness against denormalization for read performance, and evolving schemas as needs change. Foundational data-modeling judgment for building and reviewing databases, tested through open-ended domain-modeling prompts.

EasyTechnical
38 practiced

Describe how partitioning a large fact table by date can improve query performance. What partitioning scheme would you use for a table containing 10 years of daily e-commerce transaction lines and why?

MediumTechnical
51 practiced

A 'created_at' column is currently stored as TIMESTAMP WITHOUT TIME ZONE. Describe the risks when analyzing data across multiple regions, how you'd normalize timestamps for analysis, and whether you would change the schema or enforce UTC at ingestion. Include a brief SQL example for the Postgres conversion.

HardTechnical
50 practiced

You inherit a reporting schema where many dimension tables have nullable surrogate foreign keys to a central 'master' table. Query performance suffers from many LEFT JOINs producing repeated nulls. Propose schema and query-level optimizations to reduce join cost and simplify reporting queries.

EasyTechnical
33 practiced

Consider this order_items table definition:

order_items(order_id INT, product_id INT, quantity INT, price NUMERIC)

where the combination (order_id, product_id) forms the logical primary key. Explain how composite primary keys work, demonstrate how you'd join this table to orders and products, and describe when you might prefer adding a surrogate key (order_item_id) instead.

MediumTechnical
38 practiced

Given this simple schema for product reviews:

reviews(review_id, product_id, user_id, rating, comment, created_at)

A customer asks for a leaderboard of top 10 products by average rating in the last 30 days. Propose schema-level changes or indexes to make this query fast under heavy write load, explaining your choices.

Unlock Full Question Bank

Get access to all Data Modeling and Schema Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.