rendered paste body CREATE TABLE `comentarios_tmp1164119814` (
`index` int(25) NOT NULL auto_increment,
`id` int(9) NOT NULL default '0',
`idcom` int(9) NOT NULL default '0',
`nickcom` varchar(15) NOT NULL default '',
`comentario` varchar(255) NOT NULL,
`reply` char(1) NOT NULL default '',
`ip` varchar(15) NOT NULL default '',
`fecha` bigint(20) NOT NULL default '0',
PRIMARY KEY (`index`),
KEY `id` (`id`),
KEY `idcom` (`idcom`)
) ENGINE=MEMORY AUTO_INCREMENT=10932809 DEFAULT CHARSET=latin1
mysql> explain SELECT `index`,id, idcom, nickcom, comentario, reply, ip, fecha FROM `genteya_comentarios`.`comentarios_tmp1164119814` WHERE `idcom`=46068 ORDER BY `index` DESC LIMIT 0,125;
+----+-------------+---------------------------+------+---------------+-------+---------+-------+------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------------+------+---------------+-------+---------+-------+------+-----------------------------+
| 1 | SIMPLE | comentarios_tmp1164119814 | ref | idcom | idcom | 4 | const | 17 | Using where; Using filesort |
+----+-------------+---------------------------+------+---------------+-------+---------+-------+------+-----------------------------+
1 row in set (0.00 sec)
ALTER TABLE `comentarios_tmp1164119814` DROP INDEX `idcom` ,
ADD INDEX `idcom` ( `idcom` , `index` );
mysql>
mysql> explain SELECT `index`,id, idcom, nickcom, comentario, reply, ip, fecha FROM `genteya_comentarios`.`comentarios_tmp1164119814` WHERE `idcom`=46068 ORDER BY `index` DESC LIMIT 0,125;
+----+-------------+---------------------------+------+---------------+------+---------+------+-------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------------+------+---------------+------+---------+------+-------+-----------------------------+
| 1 | SIMPLE | comentarios_tmp1164119814 | ALL | idcom | NULL | NULL | NULL | 37448 | Using where; Using filesort |
+----+-------------+---------------------------+------+---------------+------+---------+------+-------+-----------------------------+
1 row in set (0.00 sec)