“SELECT COUNT(*)” is slow, even with where clause

后端 未结 8 1638
抹茶落季
抹茶落季 2020-11-30 23:22

I\'m trying to figure out how to optimize a very slow query in MySQL (I didn\'t design this):

SELECT COUNT(*) FROM change_event me WHERE change_event_id >         


        
8条回答
  •  感情败类
    2020-11-30 23:55

    To make the search more efficient, although I recommend adding index. I leave the command for you to try the metrics again

    CREATE INDEX ixid_1 ON change_event (change_event_id);
    

    and repeat query

    SELECT COUNT(*) FROM change_event me WHERE change_event_id > '1212281603783391';
    

    -JACR

提交回复
热议问题