How do I find out exactly why a query is taking so long?
When I query against a view (SELECT * FROM myView) in my test
environment, it comes back immediately. When I do the same query in my
production environment, it takes 2-3 minutes to come back with the
same data.
The environments are running on identical hardware with identical
software revisions (MySQL 5.1.17 on Linux) and almost-identical data
(we refreshed the test environment with production data a few days
ago).
How can I diagnose this, and find out why the query is taking so long
in production?
|