Description:
Hi,
Would it be possible to explain how we can see the used partitions while partition pruning occurs. For instance "explain" statement showing that only one partition is scanned.
Let me know.
Best Regards
Yann
How to repeat:
I have partitioned table and I do not see that partitioning pruning occurs in the explain plan :
mysql> explain select count(*) from sales_range where year(sales_date) = '2008';
+----+-------------+-------------+------+---------------+------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+------+---------------+------+---------+------+---------+-------------+
| 1 | SIMPLE | sales_range | ALL | NULL | NULL | NULL | NULL | 1000000 | Using where |
+----+-------------+-------------+------+---------------+------+---------+------+---------+-------------+
1 row in set (0.00 sec)
The tables sales range contains 100000 rows and looks like :
CREATE TABLE IF NOT EXISTS sales_range
(salesman_id INT,
product_id INT,
sales_amount INT,
sales_date DATE) engine=MyISAM
PARTITION BY RANGE(YEAR(sales_date))
(
PARTITION sales_year_2008 VALUES LESS THAN (2009),
PARTITION sales_year_2009 VALUES LESS THAN (2010),
PARTITION sales_year_2010 VALUES LESS THAN (2011),
PARTITION sales_year_2011 VALUES LESS THAN (2012)
);
Suggested fix:
The explain feature should show when partition prunning occurs isn't it ?
No reference to the way how to monitor partition pruning in the doc.