I read a lot of articles that PARTITION
ing is not helpful in most cases. I believe it should speed up the queries in my case. I have a table with the structure of
CREATE TABLE pages
(
page_id int(11) unsigned NOT NULL AUTO_INCREMENT,
category_id smallint(5) unsigned,
title varchar(255),
created datetime,
updated datetime,
FOREIGN KEY(category_id) REFERENCES categories(category_id) ON DELETE CASCADE,
UNIQUE INDEX (category_id,title),
INDEX(title),
PRIMARY KEY(page_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci ROW_FORMAT=COMPRESSED
The table is close to 1 billion rows and 200-1000 category_id
.
Almost all queries have category_id
in it.
I consider PARTITION
ing the table as
PARTITION BY KEY(category_id)
PARTITIONS 40; // between 20-50
Is it worthy?