Hi,
Could someone take a look at this and tell me why it might be slower than I expected? The search of course is slow the first time, and after that it gets cached ( and much faster ). But I am looking to speed up the initial search.
mysql> EXPLAIN select * FROM unit_history LEFT OUTER JOIN unit_auth_list ON `unit_history`.`serial`=`unit_auth_list`.`serial` where 1;+----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+| 1 | SIMPLE | unit_history | ALL | NULL | NULL | NULL | NULL | 172814 | | | 1 | SIMPLE | unit_auth_list | eq_ref | serial | serial | 22 | mgmt_db.unit_history.serial | 1 | | +----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+2 rows in set (0.00 sec)mysql> select count(*) FROM `unit_history` LEFT OUTER JOIN `unit_auth_list` ON `unit_history`.`serial`=`unit_auth_list`.`serial` WHERE (`unit_auth_list`.`major_name` LIKE '%testsearch%' ) ORDER BY `unit_auth_list`.`major_name` DESC ,`unit_history`.`date`;+----------+| count(*) |+----------+| 33772 | +----------+1 row in set (9.89 sec)mysql> SELECT * FROM `unit_history` LEFT OUTER JOIN `unit_auth_list` ON `unit_history`.`serial`=`unit_auth_list`.`serial` WHERE (`unit_auth_list`.`major_name` LIKE '%testsearch%' ) ORDER BY `unit_auth_list`.`major_name` DESC ,`unit_history`.`date` DESC LIMIT 0,30.....output snipped out.....30 rows in set (17.25 sec)
Thanks!
-Brian
Could someone take a look at this and tell me why it might be slower than I expected? The search of course is slow the first time, and after that it gets cached ( and much faster ). But I am looking to speed up the initial search.
mysql> EXPLAIN select * FROM unit_history LEFT OUTER JOIN unit_auth_list ON `unit_history`.`serial`=`unit_auth_list`.`serial` where 1;+----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+| 1 | SIMPLE | unit_history | ALL | NULL | NULL | NULL | NULL | 172814 | | | 1 | SIMPLE | unit_auth_list | eq_ref | serial | serial | 22 | mgmt_db.unit_history.serial | 1 | | +----+-------------+----------------+--------+---------------+--------+---------+------------------------------+--------+-------+2 rows in set (0.00 sec)mysql> select count(*) FROM `unit_history` LEFT OUTER JOIN `unit_auth_list` ON `unit_history`.`serial`=`unit_auth_list`.`serial` WHERE (`unit_auth_list`.`major_name` LIKE '%testsearch%' ) ORDER BY `unit_auth_list`.`major_name` DESC ,`unit_history`.`date`;+----------+| count(*) |+----------+| 33772 | +----------+1 row in set (9.89 sec)mysql> SELECT * FROM `unit_history` LEFT OUTER JOIN `unit_auth_list` ON `unit_history`.`serial`=`unit_auth_list`.`serial` WHERE (`unit_auth_list`.`major_name` LIKE '%testsearch%' ) ORDER BY `unit_auth_list`.`major_name` DESC ,`unit_history`.`date` DESC LIMIT 0,30.....output snipped out.....30 rows in set (17.25 sec)
Thanks!
-Brian
Comment