| From: | David Olbersen <dave(at)slickness(dot)org> |
|---|---|
| To: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
| Cc: | <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Optimization via explicit JOINs |
| Date: | 2001-03-09 23:54:05 |
| Message-ID: | Pine.LNX.4.31.0103091552060.6092-100000@bubbles.electricutopia.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christopher Sawtell | 2001-03-10 00:57:32 | Re: from PosgreSQL 7.1b3 to 7.0.3 |
| Previous Message | Stephan Szabo | 2001-03-09 23:10:14 | Re: Optimization via explicit JOINs |