I have a really large, complex query I'm trying to optimise using MySQL EXPLAIN SELECT
or EXPLAIN EXTENDED SELECT
.
If I run it against the query, I'll see every table in the query is using Using where
in the Extra
column, which is great.
No data will be changed at all, I'll go off and make a cup of tea or something, come back and re-run EXPLAIN
.
This time, just a few minutes later, only 20% of the tables are Using where
, the primary table is now Using index; Using temporary; Using filesort
, and my day becomes a nightmare trying to debug this.
I am aware that sometimes things like temporary tables and filesorts are more efficient than using where clauses and indexes. But not in the case of this database, which is 10GB in size, and creating temporary tables and filesorts kills the server completely.
Any ideas why this would be happening? Is there logic or reason behind such a thing?!