ముందుగా access pattern కోసం design చేయండి, తర్వాత partitioning + సరైన index/PK ను ఎంచుకోండి తద్వారా ఏ single query అయినా చిన్న, bounded slice ను తాకుతుంది — ఎప్పుడూ 10B rows ను scan చేయదు. 10 billion records పై sub-100ms వేగవంతమైన disk గురించి కాదు; అది working set ను చిన్నగా చేయడం గురించి.
Query ─▶ Router ──▶ Partition (by tenant/time) ──▶ Index/PK lookup ─▶ ~thousands of rows
│ (prune 99.9% of data) (B-tree / sort key)
└─▶ Cache (Redis) ─▶ hit? return in <5ms
miss ▼
Columnar store (ClickHouse) for aggregates / scans
Access patterns అన్నింటినీ నడిపిస్తాయి
tech ను ఎంచుకోవడానికి ముందు, అడగండి: "user X యొక్క చివరి 20 orders ను పొందండి" ఒక point/range query — partition మరియు sort key దానికి సరిగ్గా match కావాలని మీరు కోరుకుంటారు. "ఈ నెల region వారీగా revenue ను sum చేయండి" ఒక analytical scan — ఒక row store తప్పు tool. ముందుగా query ను model చేయడమే పనిచేసే design ను reasonable గా కనిపించే కానీ full-scan చేసే దాని నుండి వేరు చేస్తుంది.
