MySQL Forums
Forum List  »  Partitioning

MySQL 2 Subpartition
Posted by: levent ayan
Date: February 16, 2017 12:06PM

I have table with 3 columns in MySQL, and I have partition on year and sub-partition on month

CREATE TABLE report (
id BIGINT NOT NULL AUTO_INCREMENT,
impressions INT UNSIGNED,
created_at date NOT NULL,
PRIMARY KEY (id, created_at)
)
PARTITION BY RANGE( YEAR(created_at) )
SUBPARTITION BY HASH( MONTH(created_at) )
SUBPARTITIONS 12 (
PARTITION y0 VALUES LESS THAN (2018),
PARTITION y1 VALUES LESS THAN (2019),
PARTITION y2 VALUES LESS THAN (2020),
PARTITION y3 VALUES LESS THAN (2021),
PARTITION y4 VALUES LESS THAN MAXVALUE
);


I'm trying to one more sub-partition on days. I want to make it like below.

Parent partition: Years(y0, y1, y2, y3)
Sub-partition of years: Month(m1, m2, m3, m4, m5, ..., m10, m11, m12)
Sub-partition of months: Day(d1, d2, d3, d4, d5, d6, d7, ....., d30, d31)

Is this possible ?

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL 2 Subpartition
2010
February 16, 2017 12:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.