Το partitioning δεδομένων (sharding) διαιρεί τα δεδομένα σε πολλούς servers/databases έτσι ώστε ο καθένας να περιέχει ένα υποσύνολο — ενεργοποιώντας την οριζόντια κλιμάκωση δεδομένων και φόρτου πέρα από έναν μόνο server. Η επιλογή του τρόπου διαμέρισης (το partition key και η στρατηγική) είναι κρίσιμη.
Τι είναι το partitioning/sharding
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
Στρατηγικές partitioning
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)
