| Bug #55467 | First partition is not pruned | ||
|---|---|---|---|
| Submitted: | 22 Jul 2010 3:20 | Modified: | 9 Aug 2010 6:14 |
| Reporter: | Mikiya Okuno | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Partitions | Severity: | S2 (Serious) |
| Version: | OS: | Any | |
| Assigned to: | CPU Architecture: | Any | |
[9 Aug 2010 6:14]
Mattias Jonsson
This is not a bug, it is the result after fixing bug#20577, i.e. TO_DAYS() return NULL for non-existing dates which is places in the first partition. So the first partition will always be included for range queries when the partitioning function includes TO_DAYS().

Description: When a partitioning column is compared in range, the first partition is incorrectly selected. This happens only when a partitioning column is DATE or DATETIME. How to repeat: CREATE TABLE t1 ( c1 datetime NOT NULL ) PARTITION BY RANGE (TO_DAYS(c1))( PARTITION p000001 VALUES LESS THAN (TO_DAYS('2010-04-01')), PARTITION p000002 VALUES LESS THAN (TO_DAYS('2010-05-01')), PARTITION p000003 VALUES LESS THAN (TO_DAYS('2010-06-01')), PARTITION p000004 VALUES LESS THAN (TO_DAYS('2010-07-01')), PARTITION p000005 VALUES LESS THAN (TO_DAYS('2010-08-01')), PARTITION pmax VALUES LESS THAN MAXVALUE ); explain partitions select * from t1 where c1 between '2010-07-01' and '2010-07-21'\G explain partitions select * from t1 where c1 > '2010-07-01'\G Suggested fix: no idea