Re: Need SQL Help Finding Current Status of members

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Need SQL Help Finding Current Status of members
Дата
Msg-id 20051216135732.GA22004@surnet.cl
обсуждение исходный текст
Ответ на Re: Need SQL Help Finding Current Status of members  ("Michael Avila" <Michael.Avila.1@sbcglobal.net>)
Список pgsql-sql
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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Michael Avila"
Дата:
Сообщение: Re: Need SQL Help Finding Current Status of members
Следующее
От: "Ken Winter"
Дата:
Сообщение: Rule causes baffling error