Mysql partitioning

From wikinotes
Revision as of 18:07, 24 September 2022 by Will (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Partitioning is a write-optimization.

A partitioned table's contents are stored in different locations (ex. different servers).
A partitioning key is passed to a function to determine which partition a row or column should belong to.

Partitions must share the same storage-engine

Frequently a globally relevant identifier is used as the partitioning key (ex. a user).
then all of the rest of their data (ex. comments, projects, posts, ..) are stored on the same database instance.

Partition Methods

horizontal:  rows are partitioned
vertical:    cols are partitioned

Partitioning Strategies

Partition Introspection

EXPLAIN PARTITIONS SELECT * FROM users;  # list partitions, partition-key for query