Re: Why are my sorts so slow?

2003-06-16 Thread Dr. Frank Ullrich
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: SELECT

Why are my sorts so slow?

2003-06-13 Thread Bruce Leidl
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: SELECT col1,col2,col3 from table1 where

Re: Why are my sorts so slow?

2003-06-13 Thread Brent Baisley
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

RE: Why are my sorts so slow?

2003-06-13 Thread David Brodbeck
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