Details
-
Type:
Task
-
Status: Stalled
-
Priority:
Major
-
Resolution: Unresolved
-
Fix Version/s: 10.2
-
Component/s: None
-
Labels:None
Description
I created a table based on a hash of a date:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT NOW(),
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY HASH( DAYOFYEAR(hired) )
PARTITIONS 45;
I would think that the query engine could prune searches since the hash value is, in my situation, monotonically increasing, but it does not appear to be the case. In a range search, the optimizer should be able to put the lower and upper bounds of the range into the hash function to come up with the upper and lower bounds for pruning partitions.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Hashes don't work that way. They generally don't preserve the order, so even if the function would be monotonically increasing, the hash of it wouldn't be. That's why an optimizer cannot possibly guess the range of hash values from the range of hash arguments.