MySQL Techniques
by Nathan Lyle <nathan(at)upwebmaestro.com>
|
Date: |
Wed, 4 Dec 2002 14:59:36 -0500 |
To: |
hwg-techniques <hwg-techniques(at)hwg.org> |
|
todo: View
Thread,
Original
|
|
Ok... I *sort* of asked something similar a while back, but have since
refined my problems. (I suppose that's progress.)
I have a database in MySQL of three large tables:
master (20,938 rows)
artist (46,734 rows)
track (238,350 rows)
I've reduced query times to next to instantaneous when selecting from
any of the tables individually. (The Match/Against function is
particularily quick.)
My problem is that a query that joins any of the two tables
(especially the third one) slows down to the point of being not
practical, often not even producing results in time before the server
blows the whistle and provides a page unreadable error to the browser.
(I'm using PHP to access MySQL, BTW.)
My question is one maybe of database design, but at least of function.
Is there a better way to arrange the tables that would speed things
up? Is there a better way of structuring queries?
Some quick background info: the tables hold information for a CD
library. The master table holds things like the album title, label,
library catalog number, date of entry, etc. The artist holds
(obviously) information about artists associated with a particular
album, and track holds information on the tracks for each album. Both
artist and track hold the unique id of the master row associated with
them.
Ideally, I need one query, because I want to limit the results to a
variable number, and sort them by one of a few methods. This seems to
prevent me from just loading all the initial results into PHP arrays
and dealing with the info there.
Any ideas?
~ The U.P. Web Maestro (Nathan Lyle)
E-Mail: nathan(at)upwebmaestro.com
Online: www.upwebmaestro.com
Phone: (906)485-4806
"Computers do not solve problems, they execute solutions." - Laurent Gasser.
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA