MySQL Forums
Forum List  »  Partitioning

Re: No pruning with year() function in where clause
Posted by: Mikael Ronström
Date: July 13, 2006 12:12PM

Hi,
The problem here is that your query says
YEAR(dob) IN (...)
The query optimisations for partitioning uses the same mechanisms to
discover partitions to use as is used to discover usable indexes.
If there was an index on dob MySQL would still not be able to make
the translation. This would require support for functional indexes.

It's quite clear that this is a very useful feature and such features
usually make it into a release eventually but unsure at the moment
which it will be.

Rgrds Mikael

Jonathan Krier Wrote:
-------------------------------------------------------
> Hi,
>
> According to the official documentation (18.4.
> Partition Pruning), with a range partitionning of
> years, this kind of query should benefit of
> pruning :
>
> SELECT * FROM t2 WHERE YEAR(dob) IN (1979, 1980,
> 1983, 1985, 1986, 1988);
>
> However, when I use something like "WHERE
> YEAR(myDateField) = xxx", every partition is
> checked.
>
> Is it a current limitation ?
>
>
> Regards
> Jonathan

Mikael Ronstrom
Senior Software Architect, MySQL AB
My blog: http://mikaelronstrom.blogspot.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: No pruning with year() function in where clause
3310
July 13, 2006 12:12PM


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.