InterviewStack.io LogoInterviewStack.io

Database Architecture and Partitioning Questions

Design database architecture and partitioning strategies appropriate to workload and access patterns. Evaluate database types including relational and various NoSQL models, schema design and indexing strategies, and when to use a monolithic database versus sharding. Cover sharding approaches such as range based, hash based, consistent hashing, and directory based sharding, as well as replica topologies, read replicas, replication lag, and handling cross shard queries. Address operational concerns at scale: resharding, mitigating hot partitions, balancing data distribution, transactional and consistency guarantees, and the trade offs between availability, consistency, and partition tolerance. Include monitoring, migration strategies, and impact on application logic and joins.

HardTechnical
54 practiced
Design a rebalancing algorithm for a sharded key-value store running on heterogeneous nodes (different capacities). Provide pseudocode for computing target virtual node counts per physical node, performing migration batches, and minimizing data movement. Discuss how you measure balance and how you throttle migrations to preserve client latency.
MediumTechnical
46 practiced
Explain resharding techniques: copy-based (copy then switch), scatter-gather, redirect-based (proxy forwarding), and consistent-hash-incremental. For each technique describe impact on writes/reads during migration, expected downtime, and operational complexity. Provide recommendations for 100TB datasets.
EasyTechnical
60 practiced
Given this events table schema:
events(event_id PK, user_id, occurred_at TIMESTAMP, event_type, properties JSONB)
Application patterns: frequent recent-time scans (last 7-30 days), occasional backfill scans for months, and low-latency per-user point queries. Propose a partitioning scheme (partition key(s), partitioning granularity, and indexing) that balances both analytic scans and per-user lookups. Explain reasoning and potential weaknesses.
MediumTechnical
62 practiced
Discuss local (partition-level) indexes vs global (cross-partition) indexes for partitioned tables. Explain their effect on DML performance, query planning, maintenance/DDL operations, and resharding/migration scenarios. Provide guidance on when to use local vs global indexes.
HardTechnical
51 practiced
Design an approach to maintain global unique constraints (e.g., unique email addresses) across shards without creating a central bottleneck. Include options such as centralized uniqueness service, partitioned uniqueness with reservation tokens, consistent hashing-based routing, and probabilistic filters. Discuss latency, availability, and splitting/merging implications.

Unlock Full Question Bank

Get access to hundreds of Database Architecture and Partitioning interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.