Practice
Solution
Step 1: Understand composite index column order
Composite indexes are ordered by the first column (A), then second (B). Queries filtering only on B cannot efficiently seek the index without filtering on A.Step 2: Analyze index usage at step 3
Since column A is not filtered, the engine must scan the entire index or large portions, resulting in a full index scan rather than an efficient seek.Final Answer:
Option A -> Option AQuick Check:
Composite index requires leading column filter for efficient seeks [check]
Solution
Step 1: Identify decoupling mechanism
Relational DB triggers (A) cause synchronous blocking and don't scale to 1M writes/sec. Redis (C) is fast but lacks durability and ordering guarantees for fan-out. HTTP polling (D) shifts load to clients and increases latency.Step 2: Evaluate Kafka suitability
Kafka provides durable, ordered, partitioned message queues that buffer writes and enable asynchronous fan-out delivery at high throughput.Final Answer:
Option B -> Option BQuick Check:
Kafka buffers writes asynchronously, enabling high-throughput fan-out [check]
Solution
Step 1: Understand memory constraints and error tolerance
Storing all user IDs explicitly (Redis or relational DB) is memory-heavy and not scalable for large user bases.Step 2: Identify HyperLogLog's role
HyperLogLog provides approximate unique counts with fixed small memory and tunable error, ideal for large-scale cardinality estimation.Final Answer:
Option C -> Option CQuick Check:
HyperLogLog trades accuracy for memory efficiency [check]
Solution
Step 1: Compare update and query costs
Quadtree (Use a Quadtree because it supports fast insertions and deletions with balanced trees) can become unbalanced and expensive to update frequently. R-tree (Use a full R-tree index because it guarantees minimal overlap and tight bounding rectangles) is complex and costly to maintain with frequent writes.Step 2: Evaluate Geohash benefits
Geohash (Use Geohash-based indexing because it supports efficient prefix queries and simpler updates) encodes locations into fixed-length strings allowing efficient prefix queries and simpler incremental updates, ideal for low-latency and frequent writes.Final Answer:
Option A -> Option AQuick Check:
Geohash supports efficient prefix queries and simpler updates [check]
Solution
Step 1: Understand health monitor role
The health monitor informs GSLB which data centers are healthy; without it, GSLB cannot avoid unhealthy endpoints.Step 2: Analyze failure impact
Without health info, GSLB routes users to unhealthy data centers causing failures (Users are routed to unhealthy data centers causing request failures or timeouts). Increased latency (Users experience increased latency due to rerouting through backup data centers) or DNS failures (DNS queries fail to resolve, causing complete service outage) are indirect or unlikely. Even traffic distribution (Traffic is evenly distributed regardless of data center health, causing overload) ignores health but is less precise than routing to unhealthy nodes.Final Answer:
Option A -> Option AQuick Check:
Silent health monitor failure -> routing to unhealthy data centers [check]
