From: Alvaro Herrera <alvherre@commandprompt.com>
To: Michael Avila <Michael.Avila.1@sbcglobal.net>
Cc: SQL PostgreSQL MailList <pgsql-sql@postgresql.org>
Subject: Re: Need SQL Help Finding Current Status of members
Date: Fri, 16 Dec 2005 10:57:32 -0300
Message-ID: <20051216135732.GA22004@surnet.cl> (raw)
In-Reply-To: <NBBBLNPHAMCFENDFHIDCIENFEGAA.Michael.Avila.1@sbcglobal.net>
References: <43A29304.9050801@anpe.fr>
<NBBBLNPHAMCFENDFHIDCIENFEGAA.Michael.Avila.1@sbcglobal.net>
Michael Avila wrote:
> Interesting. I think I understand that. I have never worked with a SELECT
> within a SELECT (I think that is called a subquery). I am guessing that it
> works its way through the member status records until the latest date
> "floats" to the top (nothing is > than it).
>
> Will that be a problem performance-wise if there are thousands of records?
The actual execution of the query may be something completely different,
depending on what the optimizer decides. I doubt it will suck much,
because the optimizer is quite good. Try executing
EXPLAIN query;
to see how it would be executed, and
EXPLAIN ANALYZE query;
to see the above plus the real numbers that the executor got after
executing it (number of times each loop was executed, time spent at each
execution step, etc).
Read the ANALYZE page to see how are these things supposed to be read.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alvherre@commandprompt.com, Michael.Avila.1@sbcglobal.net
Subject: Re: Need SQL Help Finding Current Status of members
In-Reply-To: <20051216135732.GA22004@surnet.cl>
* 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