The partition problem of MySQL table

I have a table of millions of data query, usually very slow to do partition table, partition according to the date of
Table one field format for 2013-07-18 15:13:40
Want to monthly partitions, please enlighten.!.

Started by Serena at November 22, 2016 - 1:46 PM

Just a little demo.

Posted by Serena at November 23, 2016 - 2:14 PM

Usually very slow if not partition can solve the problem that the index plus

Posted by Vic at December 04, 2016 - 2:51 PM

The index has been added on the table five million ten thousand data, I think the monthly partition can much faster.?

Posted by Serena at December 16, 2016 - 3:28 PM

Is this table all the query contains the time interval

Posted by Serena at December 18, 2016 - 4:19 PM

The following is an example of a MYSQL official free in the manual, it is annual partition, refer to it. The problem can go to MYSQL official free manual to see a similar theme.


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,
store_id INT
)
PARTITION BY RANGE ( YEAR(separated) ) (
PARTITION p0 VALUES LESS THAN (1991),
PARTITION p1 VALUES LESS THAN (1996),
PARTITION p2 VALUES LESS THAN (2001),
PARTITION p3 VALUES LESS THAN MAXVALUE
);

Posted by Susan at December 20, 2016 - 5:19 PM