MySQL Forums
Forum List  »  Partitioning

Select doesn't use the different partitions?
Posted by: Frank Schuster
Date: July 28, 2009 01:54AM

Hello,

I have a log table with a few millionen data records.
And I have a list partitioning for timestamp (DATETIME)
/*!50100 PARTITION BY LIST (MONTH(timestamp))
(PARTITION m5 VALUES IN (5) ENGINE = MyISAM,
PARTITION m6 VALUES IN (6) ENGINE = MyISAM,
PARTITION m7 VALUES IN (7) ENGINE = MyISAM,
PARTITION m8 VALUES IN (8) ENGINE = MyISAM) */ |

But, when I do:
explain partitions select count(*) from log USE index(timestamp) where timestamp between '2009-06-01 00:00:00' and '2009-06-31 23:59:59';

I thought, that this query use only partition 6 with about 6 million records.
But explain shows all records in the database. So the query use more than one partition.
+----+-------------+--------+-------------+-------+---------------+-----------+---------+------+--------+--------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+-------------+-------+---------------+-----------+---------+------+--------+--------------------------+
| 1 | SIMPLE | logs | m5,m6,m7,m8 | range | timestamp | timestamp | 8 | NULL | 11132772 | Using where; Using index |
+----+-------------+--------+-------------+-------+---------------+-----------+---------+------+--------+--------------------------+


What I do wrong or where is the problem?



Edited 1 time(s). Last edit at 07/28/2009 04:54AM by Frank Schuster.

Options: ReplyQuote


Subject
Views
Written By
Posted
Select doesn't use the different partitions?
3963
July 28, 2009 01:54AM


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.