Bruce,
Bruce Leidl schrieb:
>
> I'm having a problem with some very slow queries that spend a very long
> time in the 'Sorting result' state and I'm wondering how sorts are
> implemented in mysql and what I can do to optimize these types of queries.
>
> The query looks something like this:
>
>
MySQL can use indexes to sort, but not when your WHERE clause contains a
column other than the one being sorted on.
I think the MySQL manual has a good section on what 'filesort' means and
when MySQL uses it. Basically it's selecting all the rows that meet your
WHERE clause, then running a quicks
Sorts don't use indexes, for the most part, only the search part does.
Someone correct me if I'm wrong on that, I think I recall reading it in
SQL for Smarties. The index is on the entire database, not on the
subset that you have selected. If you know that your query is going to
return most of