indexing - Slow query after upgrade mysql from 5.5 to 5.6 -


we're upgrading mysql 5.5 5.6 , queries deadly slow now.

queries took 0.005 seconds before taking 49 seconds.

queries on 5.6 skipping indexes, seems:

+----+-------------+-------+-------+----------------------------------------------------+---------+---------+------+--------+-------------+ | id | select_type | table | type  | possible_keys                                      | key     | key_len | ref  | rows   |       | +----+-------------+-------+-------+----------------------------------------------------+---------+---------+------+--------+-------------+ |  1 | simple      | pens  | index | index_contents_on_slug,index_contents_on_slug_hash | primary | 4       | null | 471440 | using | +----+-------------+-------+-------+----------------------------------------------------+---------+---------+------+--------+-------------+ 1 row in set (0.00 sec) 

but not being skipped on 5.5:

+----+-------------+-------+-------------+----------------------------------------------------+----------------------------------------------------+---------+------+------+----------------------------------------------------------------------------------------------+ | id | select_type | table | type        | possible_keys                                      | key                                                | key_len | ref  | rows |                                                                                        | +----+-------------+-------+-------------+----------------------------------------------------+----------------------------------------------------+---------+------+------+----------------------------------------------------------------------------------------------+ |  1 | simple      | pens  | index_merge | index_contents_on_slug,index_contents_on_slug_hash | index_contents_on_slug_hash,index_contents_on_slug | 768,768 | null |    2 | using union(index_contents_on_slug_hash,index_contents_on_slug); using where; using filesort | +----+-------------+-------+-------------+----------------------------------------------------+----------------------------------------------------+---------+------+------+----------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) 

both dbs created same mysql dump.

are these indexes not being constructed when import on 5.6? how force index creation?

the query:

select  `pens`.* `pens`  (slug_hash = 'style' or slug = 'style') order `pens`.`id` desc limit 1 

edit: removed schema

ultimately accepted answer above correct.

the @randomseed got me thinking in right direction. optimization plans created in 5.6 different in 5.5, you'll have rework query, did.

i did not end using force index, instead removed portions of query until determined causing 5.6 miss index. reworked application logic deal that.


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -