How to partition for performance
I have a table that looks like this:
`row_id` int(11) NOT NULL AUTO_INCREMENT,
`filename` varchar(50) DEFAULT NULL,
`timestamp` datetime DEFAULT NULL,
`unit_num` int(3) DEFAULT NULL,
`string` int(3) DEFAULT NULL,
`voltage` float(6,4) DEFAULT NULL,
`impedance` float(6,4) DEFAULT NULL,
`impedance_avg10` float(6,4) DEFAULT NULL,
`amb` float(6,2) DEFAULT NULL,
`ripple_v` float(8,6) DEFAULT NULL,
`voltage_avg10` float(6,4) DEFAULT NULL,
`noise` float(8,6) DEFAULT NULL,
`filtered_impedance` float(6,4) DEFAULT NULL,
`amb_adj` float(6,2) DEFAULT NULL,
PRIMARY KEY (`row_id`),
UNIQUE KEY `timestamp` (`timestamp`,`filename`,`string`,`unit_num`),
KEY `index1` (`filename`),
KEY `index2` (`timestamp`),
KEY `index3` (`timestamp`,`filename`,`string`),
KEY `index4` (`filename`,`unit_num`)
) ENGINE=MyISAM AUTO_INCREMENT=690892041 DEFAULT CHARSET=latin1
It has over 600M rows and I need to extract, sometimes, 100,000 rows for a graph. Usually the rows are based on the unique key, which someone before me named 'timestamp. :) Anyway, since this is a time-based table that grows constantly, I thought partitioning it into partition of say, 50M records each might help since 90% of the graphs are drawn form the last 50M rows.
It is difficult to do a timestamp partition or even a hash since the primary key is just the row_id. Can someone suggest a way to make this work Does the rule still apply that the partition keys MUST exist in every unique and primary index?
Thanks!