Answer the question
In order to leave comments, you need to log in
How to properly organize Mysql Partitioning by DAYOFMONTH?
Hello!
There is a table:
CREATE TABLE `logs` (
`INSERT_DATE` datetime DEFAULT NULL,
`DATA` text NOT NULL,
KEY `INSERT_DATE` (`INSERT_DATE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (DAYOFMONTH(INSERT_DATE))
(PARTITION p0 VALUES LESS THAN (2) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (3) ENGINE = InnoDB,
...
PARTITION p30 VALUES LESS THAN (32) ENGINE = InnoDB) */
SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME LIKE 'logs';
EXPLAIN PARTITIONS SELECT * FROM logs WHERE insert_date BETWEEN '2014-10-28' AND '2014-10-29';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question