Re: Can this query go faster???

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Can this query go faster???
Дата
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3417DDA50@Herge.rcsinc.local
обсуждение исходный текст
Ответ на Can this query go faster???  (Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>)
Список pgsql-performance
> On Tue, 2005-12-06 at 11:32 +0100, Tino Wildenhain wrote:
> > You can have a row number in postgres easily too. For example if you
> > just include a serial for the row number.
> Not if the order of things is determined runtime and not at insert
time...
>
> > Cursor would work too but you would need to have a persistent
> connection.
> I just tried it: a cursor is not faster (what does not surprise me at
> all, as the amount of work looks the same to me)
>
> I guess there is no solution.
>

sure there is.  This begs the question: 'why do you want to read exactly
283745 rows ahead of row 'x'?) :)

If you are scrolling forwards in a set, just pull in, say, 100-1000 rows
at a time, ordered, and grab the next 1000 based on the highest value
read previously.

You can do this on server side (cursor) or client side (parameterized
query).   There are advantages and disadvantages to each.  If you are
looping over this set and doing processing, a cursor would be ideal (try
out pl/pgsql).

Welcome to PostgreSQL! :)

Merlin

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

Предыдущее
От: Ron
Дата:
Сообщение: Re: Can this query go faster???
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Memory Leakage Problem