Is InnoDB sorting really THAT slow?

前端 未结 6 975
挽巷
挽巷 2020-12-30 17:10

I had all my tables in myISAM but the table level locking was starting to kill me when I had long running update jobs. I converted my primary tables over to InnoDB and now m

6条回答
  •  伪装坚强ぢ
    2020-12-30 18:15

    MySQL's query optimizer is not good, from my memory. Try a subselect instead of a straight join.

    SELECT * FROM (SELECT * FROM `metaward_achiever` 
                   WHERE `metaward_achiever`.`award_id` = 1507) a
    INNER JOIN `metaward_alias` ON (a.`alias_id` = `metaward_alias`.`id`) 
    ORDER BY a.`modified` DESC 
    LIMIT 100
    

    Or something like that (untested syntax above).

提交回复
热议问题