Re: Error while retrieving data in where condition
Posted by:
Rick James
Date: February 27, 2014 08:35PM
Please run
EXPLAIN PARTITION SELECT ...
to see what "pruning" it will do. You may be unpleasantly surprised. I find that SUBPARTITIONs and anything other than simple BY RANGE does not do a good job.
I suspect it is a bug and can be reported to bugs.mysql.com.
Meanwhile, there are several things you can do to improve your schema. (They may or may not work around the bug.)
* Use NOT NULL wherever appropriate. (I see lots of NULLs, even items that are indexed.)
* Provide a PRIMARY KEY -- probably CustRepID, since it is AUTO_INCREMENT. (Meanwhile, the values of CustRepID will probably not be set as you expect!)
* Don't use BIGINT unless you really expect more than 4 billion values.
* Use UNSIGNED wherever appropriate (such as on AUTO_INCREMENT).
* Notice how it avoided the 'perfect' index (KEY `idx_Allquery` (`Custid`,`cid`,`Dt`,`AllPrnt`), ) for your query, but instead did "intersect". Suggest not putting VARCHAR(500) field in indexes.
* More than about 50 partitions --> inefficiency.
* How big is the table? Less than a million rows should not be partitioned.
Subject
Views
Written By
Posted
1694
February 24, 2014 08:13AM
736
February 25, 2014 10:50PM
1055
February 26, 2014 07:23AM
Re: Error while retrieving data in where condition
675
February 27, 2014 08:35PM
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.