Aisah Hamzah
Aisah Hamzah

Reputation: 32

MySQL query very slow on live db but fast locally and on staging?

execution time

local and prod have exactly the same amount and value of data

this is my server specification

ofcourse, my local and staging are lower than server specifiaction

List below shows what i already checked and did

  1. cpu : cpu utilization is in good condition only used 20%-25%.
  2. memory: still have a lot of memory available.
  3. db optimization :we did the db optimization but only improves 2 seconds.
  4. query execution: local only took 0.0097 to processed my query so i guess my query is good to go

What else should i check?

Upvotes: 1

Views: 2369

Answers (1)

gopher
gopher

Reputation: 51

You may try the following:

  1. Explain you sql in prod and local, check whether the output is the same.
  2. Check the running threads, to see if there are difference between prod and local: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
  3. Check if there is lock blocking your sql: SHOW ENGINE INNODB STATUS

Upvotes: 3

Related Questions