Personally, it's an unexpected flaw that I hope one day will be fixed.  But
I'm not holding my breath, even though they seem to be planning for it.  But
it could also be because of query-cache.

To benchmark something like this, you really need to add SQL_NO_CACHE to
your select statement to get accurate numbers.

Donny

> -----Original Message-----
> From: Vadim P. [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 29, 2004 8:16 PM
> To: [EMAIL PROTECTED]
> Subject: "ORDER DESC" vs. "ORDER ASC" exec time
> 
> Hi all,
> 
> Just noticed that a simple query that returns only 14 rows is 10X slower
> when "ORDER .. DESC" is used compared to "ORDER .. ASC".
> The table has about 700,000 records, indexed on the field the table is
> being ordered by.
> 
> Is this expected behavior?
> 
> MySQL  4.0.18 running under OpenBSD 3.4 Intel/PIII 900MHz/2GB RAM
> 
> =================================
> 
> mysql> SELECT distinct billingCycle FROM PhoneCalls ORDER BY
> billingCycle DESC;
> +--------------+
> | billingCycle |
> +--------------+
> | 2004-04-01   |
> | 2004-03-01   |
> | 2004-02-01   |
> | 2004-01-01   |
> | 2003-12-01   |
> | 2003-11-01   |
> | 2003-10-01   |
> | 2003-09-01   |
> | 2003-08-01   |
> | 2003-07-01   |
> | 2003-06-01   |
> | 2003-05-01   |
> | 2003-04-01   |
> | 2003-01-01   |
> +--------------+
> 14 rows in set (14.77 sec)
> 
> mysql> SELECT distinct billingCycle FROM PhoneCalls ORDER BY billingCycle;
> +--------------+
> | billingCycle |
> +--------------+
> | 2003-01-01   |
> | 2003-04-01   |
> | 2003-05-01   |
> | 2003-06-01   |
> | 2003-07-01   |
> | 2003-08-01   |
> | 2003-09-01   |
> | 2003-10-01   |
> | 2003-11-01   |
> | 2003-12-01   |
> | 2004-01-01   |
> | 2004-02-01   |
> | 2004-03-01   |
> | 2004-04-01   |
> +--------------+
> 14 rows in set (1.06 sec)
> 
> mysql>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> mysql
> query
> database
> 
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
> 




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

Reply via email to