February 2018
Intermediate to advanced
510 pages
16h 10m
English
MySQL 8 supports linear hashing, which is based on a linear power-of-two algorithm instead of regular hashing, which is based on the modulus of the hashing function's value. LINEAR HASH partitioning requires the LINEAR keyword in the PARTITION BY clause, shown as follows:
CREATE TABLE employee ( employee_id INT NOT NULL, first_name VARCHAR(30), last_name VARCHAR(30), hired_date DATE NOT NULL DEFAULT '1990-01-01', termination_date DATE NOT NULL DEFAULT '9999-12-31', job_code INT NOT NULL, store_id INT NOT NULL)PARTITION BY LINEAR HASH ( YEAR(hired_date))PARTITIONS 4;
An advantage of using linear hashing is faster partitioning operations, and a disadvantage is less even data distribution compared to regular hashing ...
Read now
Unlock full access