Re: partition pruning and DIV
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.