Michael Stassen wrote:

SELECT init FROM inits GROUP BY init ORDER BY init; +------+ | init | +------+ | A | | B | | C | ... | X | | Y | | Z | +------+ 26 rows in set (0.39 sec)

SELECT init FROM inits GROUP BY init ORDER BY init DESC;
+------+
| init |
+------+
| Z    |
| Y    |
| X    |
...
| C    |
| B    |
| A    |
+------+
26 rows in set (4.09 sec)

This is with mysql 4.0.20. As you can see, SHOW INDEX says the index on init is not packed, but DESC ordering takes 10 times as long. Explain, in case you are wondering, indicates the index on init is being used in both cases.

Does sorting really take 10 times as long? I find it hard to believe that sorting 26 rows takes 4 seconds no matter how random and unindexed the input is.
Might it be that grouping take 10 times as long? (An EXPLAIN on par with the EXPLAIN ANALYZE from PostgreSQL would be nice to have here.)


Jochem

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to