On Fri, 9 Mar 2001, Stephan Szabo wrote:
-> Hmm, what were the two queries anyway?
The "slower" query
----------------------------
SELECT
to_char( p.insertion_time, 'HH:MI AM MM/DD' ) as time_in,
s.name as title,
a.name as artist,
s.length as length
FROM
playlist p,
songs s,
artists a
WHERE
p.waiting = TRUE AND
p.song_id = s.song_id AND
s.artist_id = a.artist_id
ORDER BY p.item_id
The "faster" query
----------------------------
SELECT
to_char( p.insertion_time, 'HH:MI AM MM/DD' ) as time_in,
s.name as title,
s.length as length,
a.name as artist
FROM
playlist p JOIN songs s USING (song_id),
artists a
WHERE
p.waiting = TRUE AND
p.song_id = s.song_id AND
s.artist_id = a.artist_id
ORDER BY p.item_id;
Notice how the only difference is in the FROM clause?
-- Dave
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster