MySQL Forums
Forum List  »  Partitioning

Re: partition pruning and DIV
Posted by: Mattias Jonsson
Date: April 07, 2010 04:35PM

Instead of using DIV in the partitioning expression, use the time directly in the partition definition and partition by range:

Create Table: CREATE TABLE `Bak13` (
`sta_id` mediumint(8) unsigned NOT NULL,
`fcst_len` tinyint(3) unsigned NOT NULL,
`time` int(10) unsigned NOT NULL,
`temp` smallint(6) NOT NULL,
`dp` smallint(6) NOT NULL,
`wd` smallint(5) unsigned NOT NULL,
`ws` smallint(5) unsigned NOT NULL,
UNIQUE KEY `id_time` (`sta_id`,`time`,`fcst_len`),
UNIQUE KEY `time_id` (`time`,`sta_id`,`fcst_len`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (time)
(PARTITION p2050 VALUES LESS THAN (2051 * 604800) ENGINE = MyISAM,
PARTITION p2051 VALUES IN (2052 * 604800) ENGINE = MyISAM,
etc.

That way it will also prune if you use larger ranges.

Options: ReplyQuote


Subject
Views
Written By
Posted
4062
March 26, 2010 11:23AM
1759
April 06, 2010 09:20PM
Re: partition pruning and DIV
2082
April 07, 2010 04:35PM
1868
April 07, 2010 05:08PM


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.