ڈیٹا پارٹیشننگ (sharding) ڈیٹا کو متعدد سرورز/ڈیٹا بیسز میں تقسیم کرتی ہے تاکہ ہر ایک ایک ذیلی حصہ رکھے — جو ڈیٹا اور لوڈ کی ایک ہی سرور سے آگے horizontal scaling کو ممکن بناتا ہے۔ یہ منتخب کرنا کہ تقسیم کیسے کی جائے (partition key اور strategy) نہایت اہم ہے۔
پارٹیشننگ/شارڈنگ کیا ہے
PARTITIONING / SHARDING → divide data into pieces (partitions/shards) across multiple
servers, each holding a SUBSET:
→ no single server holds (or is overwhelmed by) all the data
→ scales STORAGE and LOAD horizontally (each shard handles its portion)
→ enables handling data/throughput beyond one machine's capacity
پارٹیشننگ کی strategies
HASH-based → hash the partition key → assign to a shard:
✓ EVEN distribution (avoids hotspots) ✗ range queries hard; resharding is tricky
RANGE-based → partition by value ranges (e.g. A-M, N-Z; date ranges):
✓ efficient range queries ✗ risk of HOTSPOTS (uneven load if data/access is skewed)
DIRECTORY/lookup → a lookup table maps keys to shards (flexible, but the lookup is overhead)
GEOGRAPHIC → partition by region (data locality)
