Reputation: 31
i have a query that take 600ms to run on the Dev machine but on Prod Machine it will take 62s to execute.but when i re-execute this query on the prod machine again it take 700ms.So there is a weird thing that let the query to take time sometimes.is that sending data or IO problem or load problem.i am using Mysql and UNIX Opensuse.i need a tool that capture this issue or if anyone know how to capture it or it happen with him before.10x
Upvotes: 3
Views: 325
Reputation: 481
Caching would explain why it takes 62s to run your query the first time then 700ms to run the second time.
If you want to see what mysql is doing while your query is running, try running FLUSH QUERY CACHE or FLUSH TABLES to clear your cache, then run your query, and in a separate session run "show processlist" a few times while your query is running. The "state" will show you what MySQL is doing.
You can also use "EXPLAIN" to analyze your query. A quick google search for "mysql explain" will result in a number of sites explaining what "EXPLAIN" does and how to use it to optimize your query or your indexes. If you're still having trouble after that, post your relevant table definitions w/ index definitions, your query, and the output from your EXPLAIN here.
As to the performance difference between dev and production... is there anything different about your two environments? Perhaps different mysql configurations or system configurations?
Upvotes: 2