Reputation:
As I am a MySQL newbie. What does PARTITION
mean in this MySQL statement?
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN (21)
);
Upvotes: 3
Views: 1050
Reputation: 133
Partitioning helps in organize the data stored in the table by splitting across different buckets.
This is analogous to how a library has separate sections of shelves for different subjects, while the catalogue/index card drawers are usually separated alphabetically.
This helps in two ways:
Here are a few links where you can get many more details:
Wikipedia article: http://en.wikipedia.org/wiki/Partition_(database)
MySQL documentation regarding partitions: http://dev.mysql.com/doc/refman/5.5/en/partitioning.html
Upvotes: 3
Reputation: 344411
Partitioning is a way of pre-organizing table storage. You can say "some of the table's rows will go here, some will go there, still others will go to to still other places". Often, depending on the storage engine, the effect is to spread the table's rows over different files or even different disks.
From: MySQL 5.1 New Features: MySQL Partitions
You may also be interested in seeking further information on "horizontal partitioning", in order to better understand the scenarios where this is particularly useful.
Upvotes: 4