Re: Paging Through Query Result Sets

Поиск
Список
Период
Сортировка
От Joe Abbate
Тема Re: Paging Through Query Result Sets
Дата
Msg-id 5171CB6E.9050407@freedomcircle.com
обсуждение исходный текст
Ответ на Paging Through Query Result Sets  (Don Parris <parrisdc@gmail.com>)
Список psycopg
Hello Don,

On 19/04/13 18:38, Don Parris wrote:
> I would like to be able to page through a result set when there is more
> than one screenful of data.  Is there a good example of paging through a
> query result set in Bash - something like implementing the less
> command?  Even if I can't scroll backwards through the result set, at
> least being able to control the paging forward would be good.

In web applications, paging is usually done by using PG's LIMIT and
OFFSET.  So if you're displaying the third page of 200 rows 30 rows at a
time, your SELECT would end with LIMIT 30 OFFSET 90.

If I may toot my horn, I've implemented this logic in Pyrseas.  If
you're interested see the subset method in:

https://github.com/jmafc/Pyrseas/blob/master/pyrseas/relation/join.py

Regards,

Joe


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

Предыдущее
От: Don Parris
Дата:
Сообщение: Paging Through Query Result Sets
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: Paging Through Query Result Sets