On Thu, 03 Jan 2002 09:21:45 -0600, Dan Liu used a few recycled electrons to
form:

| Hi everyone,
| I ran a query which is:
| select A.a as a,B.b as b from A left join B on A.c=B.c and A.d=B.d order by A.c,A.d;
| Both table A and Table B have about 3000 records.And there are about 3000 records in 
|the result.But it takes 3 minutes and 50 seconds to run the query.
| Does anybody know how to make it faster?

Considering the amount of information supplied (table structures, type of data,
mysql version, and hardware), I'll make some suggestions with few assumptions,
which depending on the accuracy of the assumptions may work for you.

1. Index A.c, B.c, A.d, and B.d
2. Increase from 32M of ram to 16G
3. Put your data on an array of striped RAID 15k RPM SCSI disks
4. Upgrade from a 486 to a new Quad Xeon
5. Upgrade to the newest version of mysql
6. Change all your field types to TINYINT (note: might
   change result set)
7. Run "TRUNCATE TABLE A;TRUNCATE TABLE B;" before running 
   your "select". (Note: this will change your result set)

Well, all those are sure to speed up your results 
(depending on your current situation)!

Hope that helps!  :)

Michael

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to