Compare D1 performance with Smart Placement, Read Replication + KV Caching
Direct database queries (Smart Placement optimized)
SELECT single row by ID
5 SELECT queries in batch
INSERT single row
10 INSERTs in batch
3-table JOIN (orders+users+products)
GROUP BY with SUM, COUNT, AVG
Sessions API routes reads to nearest replica for lower global latency
Routes to nearest read replica
Forces routing to primary DB
Compare Direct vs Replica vs Primary
Queries with Workers KV caching layer (run twice to see cache hits)
KV cache with D1 fallback
Multi-key KV lookup
Complex query result caching
Run D1 direct vs KV cached (cold + warm) side-by-side