MySQL Forums
Forum List  »  Partitioning

Partition and pruning by ENUM
Posted by: Eric Palacios
Date: October 30, 2006 05:36AM

Hi,

I'm currently using partition functions that uses enums and in order to convert them to int i use CAST or CONVERT, but it seems that it's not pruning at all when i show the explain partitions.

For example:

CREATE TABLE temp (
en1 enum('USER','TRACK','ALBUM','ARTIST'),
date DATE,
PRIMARY KEY(en1,date)
) ENGINE=InnoDB
PARTITION BY HASH(CAST(en1 as UNSIGNED)) PARTITIONS 4;

==============================

mysql> EXPLAIN PARTITIONS select * from temp where en1 = 'USER';
+----+-------------+-------+-------------+------+---------------+---------+---------+-------+------+--------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------------+------+---------------+---------+---------+-------+------+--------------------------+
| 1 | SIMPLE | temp | p0,p1,p2,p3 | ref | PRIMARY | PRIMARY | 1 | const | 4 | Using where; Using index |
+----+-------------+-------+-------------+------+---------------+---------+---------+-------+------+--------------------------+


Is there any workaround for this ?

Thank you in advance,

Eric.

Options: ReplyQuote


Subject
Views
Written By
Posted
Partition and pruning by ENUM
6516
October 30, 2006 05:36AM
3394
November 06, 2006 03:34AM


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.