Search Postgresql Archives

Re: Implementing next 30 (or so) rows "sliding window"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 8, 2009 at 12:12 PM, Allan Kamau <kamauallan@xxxxxxxxx> wrote:
> Hi,
> I did follow the basic advise and consulted the documentation for
> "SELECT" and came across "[ FETCH { FIRST | NEXT } [ count ] { ROW |
> ROWS } ONLY]" clause which seems to satisfy my requirement.

This is a cursor, which is one of two very basic ways of doing this.
IF you have presistent objects in your app layer, you can declare a
cursor and reuse it as your user moves through the list, one page
after another.  If you do not have some kind of persistence layer for
db objects, then declaring a cursor each time a user navigates to
another page won't really gain you much, and adds complexity.

In that instance offset / limit work fairly well.  As another poster
mentions, it gets slow with large offsets.  However, most of the time,
like in forum software, you don't go dragging to page 258 of a result
set very often, so a small delay when doing so is usually acceptable.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux