From: David Olbersen <dave@slickness.org>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Optimization via explicit JOINs
Date: Fri, 9 Mar 2001 15:54:05 -0800 (PST)
Message-ID: <Pine.LNX.4.31.0103091552060.6092-100000@bubbles.electricutopia.net> (raw)
In-Reply-To: <Pine.BSF.4.21.0103091508360.82223-100000@megazone23.bigpanda.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: dave@slickness.org, sszabo@megazone23.bigpanda.com
Subject: Re: Optimization via explicit JOINs
In-Reply-To: <Pine.LNX.4.31.0103091552060.6092-100000@bubbles.electricutopia.net>
References: <Pine.BSF.4.21.0103091508360.82223-100000@megazone23.bigpanda.com> <Pine.LNX.4.31.0103091552060.6092-100000@bubbles.electricutopia.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox