Re: Query optimization (select single record and join)

From: Richard Huxton <dev(at)archonet(dot)com>
To: Orest Kozyar <orest(dot)kozyar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query optimization (select single record and join)
Date: 2007-06-29 15:21:23
Message-ID: 46852373.80608@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Orest Kozyar wrote:
> What I am wondering is whether the database first eliminate all rows in
> tableA that don't meet the criteria before performing the join, or does it
> perform the join first then eliminate all records that don't meet the
> criteria?

If you use "EXPLAIN SELECT ..." then PostgreSQL will tell you how it's
going to execute your query. If you use "EXPLAIN ANALYZE SELECT ..." it
will tell you what it actually did too. See manuals and google for
details and discussion.

Oh, and if you don't know about VACUUM and ANALYZE you'll probably want
to read up on those too.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2007-06-29 15:21:33 Re: pg_catalog.pg_get_serial_sequence() returns NULL
Previous Message Jim Nasby 2007-06-29 15:15:54 Re: Standby servers and incrementally updated backups