Quiero particionar una tabla mysql por columna de fecha y hora. Un día, un partition.The crear secuencias de comandos de la tabla es la siguiente:cómo dividir una tabla por columna de fecha y hora?
CREATE TABLE raw_log_2011_4 (
id bigint(20) NOT NULL AUTO_INCREMENT,
logid char(16) NOT NULL,
tid char(16) NOT NULL,
reporterip char(46) DEFAULT NULL,
ftime datetime DEFAULT NULL,
KEY id (id)
) ENGINE=InnoDB AUTO_INCREMENT=286802795 DEFAULT CHARSET=utf8
PARTITION BY hash (day(ftime)) partitions 31;
Pero cuando selecciono los datos de algunos day.It no pudo localizar la instrucción select partition.The es así:
explain partitions select * from raw_log_2011_4 where day(ftime) = 30;
cuando uso otra declaración, podría ubicar la partición, pero no puedo seleccionar datos de algún día.
explain partitions select * from raw_log_2011_4 where ftime = '2011-03-30';
¿Hay alguien dime cómo podría seleccionar datos de algún día y hacer uso de la partición. ¡Gracias!
'^ 1' ¿y si el número de años en la tabla es desconocido, si' PARTITION BY hash (YEAR (ftime)) 'funcionará? –