Re: nested query on last n rows of huge table

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: nested query on last n rows of huge table
Дата
Msg-id DF8206DD-3B0F-41DA-BA21-4D14945EB7BF@myrealbox.com
обсуждение исходный текст
Ответ на nested query on last n rows of huge table  ("jcfischer" <jcfischer.lists@gmail.com>)
Список pgsql-performance
On Feb 24, 2006, at 23:13 , jcfischer wrote:

> Is there a way to limit the expensive query to only those last 1000
> (or
> whatever) results?

>
> I have tried to nest SELECTS but my SQL-fu is to limited to get
> anything through the SQL processor :-)

The basics of a subquery are:

SELECT <expensive query>
FROM (
    SELECT *
    FROM table
    ORDER eventtime DESC
    LIMIT 1000
    ) as most_recent_1000

Don't know enough about the other parts, but hopefully this can get
you started. :)

Michael Glaesemann
grzm myrealbox com




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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Large Table With Only a Few Rows
Следующее
От: PFC
Дата:
Сообщение: Re: wal sync method