I currently have a table with about 6 million records that in turn perform a lot of I / O operations, so in designing the project I chose to use InnoDB instead of MyISAM in MySQL, after all, lock would be per page, not per table.
But I have a huge problem, the MAJOR of the queries made in this table is through a ** date period . By concept I tried to partition it, but I came across this InnoDB limitation
What do you suggest to improve the performance of these queries? Given that I have a very large hardware limitation?
The table structure is shown below.
CREATE TABLE 'sensores' (
'id' int(11) NOT NULL AUTO_INCREMENT,
'equipamento_id' int(11) NOT NULL,
'data_hora' datetime DEFAULT NULL,
'valor_primario' float(10,6) DEFAULT NULL,
'valor_secundario' float(10,6) DEFAULT NULL,
PRIMARY KEY ('id'),
KEY 'fk_sensor_equipamento_idx' ('equipamento_id'),
KEY 'data_hora' ('data_hora'),
CONSTRAINT 'fk_sensor_equipamento_idx' FOREIGN KEY ('equipamento_id') REFERENCES 'equipamento' ('id') ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3515782247 DEFAULT CHARSET=utf8;
The operation consists of numerous "sensors" writing equipment read information in this table every 15 seconds.
Most querys performed are similar to instruction
SELECT * FROM sensores WHERE data_hora BETWEEN ? AND ?