API performance

N+1 queries, pooling, caching and p99.

41 questions5 topics4 levels20 must‑knowFree, no account

Your progress

L1 · 0 of 10L2 · 0 of 20L3 · 0 of 10L4 · 0 of 1

Level 1 · 10 questions. Begin with what gets asked in the first ten minutes. Levels 2 to 4 build on it.

Start with Level 1
Level 1First ten minutesTwo-sentence answers to what gets asked first.10 questions · 4 topics

API latency optimization: from 800 ms to 250 ms, step by step

  1. 1.1Compress with gzip or brotli1 min
  2. 1.2No SELECT *Must‑know1 min
  3. 1.3Paginate and return only needed fieldsMust‑know1 min
  4. 1.4Rerun the same load test against the baseline1 min
  5. 1.5Why percentiles and not the average?Must‑know1 min

Clustered vs nonclustered indexes: SQL interview answers

  1. 2.1What happens when you search for a row without an index?Must‑know1 min
  2. 2.2What is a clustered index?Must‑know1 min
  3. 2.3Why not add an index for every query?Must‑know1 min

SQL CROSS JOIN cardinality

  1. 3.1How many rows does a comma join return, and what happens when one table is empty?2 min

SQL grouping and group filters

  1. 4.1How do GROUP BY and HAVING differ, and where does WHERE fit?Must‑know2 min
Level 2Daily jobWhat you use at work every week.20 questions · 2 topics

API latency optimization: from 800 ms to 250 ms, step by step

  1. 1.1Cache with ETag and Cache-Control1 min
  2. 1.2Composite indexes: equality columns first, then rangeMust‑know1 min
  3. 1.3Connection pooling (HikariCP, PgBouncer)Must‑know1 min
  4. 1.4Dashboards and alerts for regressions1 min
  5. 1.5Don't wrap indexed columns in functions in WHEREMust‑know1 min
  6. 1.6EXISTS instead of IN for large subqueries1 min
  7. 1.7Find slow queries: pg_stat_statements and EXPLAIN (ANALYZE, BUFFERS)Must‑know2 min
  8. 1.8Find the bottleneck with APM tracesMust‑know3 min
  9. 1.9How do you find and fix an N+1 problem?Must‑know3 min
  10. 1.10How do you make sure an application meets its performance requirements?Must‑know1 min
  11. 1.11Keyset pagination instead of OFFSETMust‑know1 min
  12. 1.12Make independent calls in parallel1 min
  13. 1.13Move slow work to a background queueMust‑know1 min
  14. 1.14Multi-row INSERT or COPY instead of one row at a time4 min
  15. 1.15OFFSET pagination is slow on page 5,000. Why, and how do you fix it?Must‑know4 min
  16. 1.16Redis cache-aside for read-often, change-rarely dataMust‑know1 min
  17. 1.17Remove N+1 queries (fetch joins or batch fetching)Must‑know1 min
  18. 1.18Set a baseline (k6, JMeter or Locust; p50, p95, p99 and throughput)Must‑know1 min

Clustered vs nonclustered indexes: SQL interview answers

  1. 2.1What does INCLUDE do, and what makes an index covering?1 min
  2. 2.2What is stored in a nonclustered index?1 min
Level 3SeniorProduction trade-offs and failure modes.10 questions · 3 topics

API latency optimization: from 800 ms to 250 ms, step by step

  1. 1.1Check database health (seq_scan, dead tuples, lock waits, buffer hit ratio)1 min
  2. 1.2Covering indexes with INCLUDE (index-only scans)1 min
  3. 1.3Fresh statistics (ANALYZE) and autovacuum tuning against bloat1 min
  4. 1.4Partial indexes for hot subsets1 min
  5. 1.5Read replicas or partitioning for heavy tables2 min
  6. 1.6When do you add a cache, and what are the risks?7 min
  7. 1.7Your API p99 went from 200 ms to 2 s. What do you do?6 min

Clustered vs nonclustered indexes: SQL interview answers

  1. 2.1How does this differ in PostgreSQL?1 min
  2. 2.2What is a Key Lookup?1 min

PostgreSQL materialized views

  1. 3.1When is a materialized view useful, and how do you manage staleness?2 min
Level 4InternalsHow it works underneath, and at scale.1 questions · 1 topics

Clustered vs nonclustered indexes: SQL interview answers

  1. 1.1Why does a B+ tree lookup on a large table read only a few pages?1 min