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 batch inserts (A) add latency and don't handle high write throughput well. Redis (C) lacks durability guarantees for buffering. Direct synchronous calls (D) cause backpressure and tight coupling.Step 2: Evaluate Kafka suitability
Kafka supports high-throughput, partitioned by user ID to maintain ordering per user, and durable storage, enabling asynchronous processing and backpressure handling.Final Answer:
Option D -> Option DQuick Check:
Kafka partitions decouple ingestion and scoring with durability and ordering [check]
Solution
Step 1: Identify component roles
Load Balancers distribute traffic but do not inspect or modify requests; Reverse Proxies forward requests but lack built-in authentication and rate limiting; DNS-based load balancing is coarse and lacks request-level control.Step 2: Match scenario requirements
API Gateway supports routing based on URL paths, authentication, and rate limiting, fulfilling all requirements.Final Answer:
Option C -> Option CQuick Check:
API Gateway handles routing and policies at HTTP layer [check]
Solution
Step 1: Analyze consistency and availability needs
Strong consistency requires coordination; high availability requires fault tolerance.Step 2: Evaluate architectures
Consensus-based clusters provide strong consistency and tolerate failures; single server risks downtime; independent shards lack coordination; eventual consistency violates strong consistency.Final Answer:
Option A -> Option AQuick Check:
Consensus clusters balance strong consistency and availability [check]
Solution
Step 1: Analyze write scalability and read patterns
High write throughput and millions of users require scalable writes and efficient feed reads.Step 2: Evaluate referencing with denormalization
Referencing separates concerns; denormalizing popular posts into feeds optimizes read performance without large documents.Final Answer:
Option D -> Option DQuick Check:
Referencing plus denormalization balances write scale and read speed [check]
