0
0
HLDsystem_design~20 mins

Cross-shard queries in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cross-Shard Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Cross-Shard Query Challenges

Which of the following best describes a primary challenge when executing cross-shard queries in a distributed database system?

AEnsuring data consistency and atomicity across multiple shards during query execution
BReducing the size of individual shards to improve query speed
CIncreasing the number of shards to reduce network latency
DUsing a single master node to handle all queries
Attempts:
2 left
💡 Hint

Think about what happens when data is spread across multiple independent storage units.

Architecture
intermediate
2:00remaining
Choosing a Cross-Shard Query Coordination Method

Which architecture pattern is commonly used to coordinate cross-shard queries to ensure consistency and minimize latency?

AUsing a single shard to store all data to avoid cross-shard queries
BCentralized coordinator that collects partial results from shards and merges them
CRandom shard selection to reduce load on any single shard
DEach shard independently returns full query results without coordination
Attempts:
2 left
💡 Hint

Consider how partial results from different shards can be combined efficiently.

scaling
advanced
2:00remaining
Scaling Cross-Shard Query Performance

To improve the performance of cross-shard queries in a system with many shards, which approach is most effective?

AImplementing parallel query execution across shards with asynchronous result aggregation
BReducing the number of shards to minimize network hops
CIncreasing the replication factor of each shard to reduce read latency
DUsing synchronous blocking calls to each shard sequentially
Attempts:
2 left
💡 Hint

Think about how to use concurrency to reduce total query time.

tradeoff
advanced
2:00remaining
Tradeoffs in Cross-Shard Query Consistency Models

Which tradeoff is typically encountered when choosing between strong consistency and eventual consistency for cross-shard queries?

AEventual consistency requires locking all shards, increasing latency
BStrong consistency reduces latency but risks stale data; eventual consistency increases latency but guarantees up-to-date data
CBoth models provide the same latency and data freshness guarantees
DStrong consistency increases latency but guarantees up-to-date data; eventual consistency reduces latency but may return stale data
Attempts:
2 left
💡 Hint

Consider how data freshness and response time relate in distributed systems.

estimation
expert
3:00remaining
Estimating Network Overhead in Cross-Shard Queries

A system has 10 shards. Each shard returns 1 MB of data per query. The network bandwidth between coordinator and shards is 100 Mbps. Approximately how long will it take to transfer all shard data to the coordinator if queries are executed in parallel and network bandwidth is fully utilized?

AAbout 80 seconds
BAbout 8 seconds
CAbout 0.8 seconds
DAbout 0.08 seconds
Attempts:
2 left
💡 Hint

Calculate total data size and convert bandwidth to MB/s for transfer time.