Skip site navigation (1) Skip section navigation (2)

Re: COUNT & Pagination

From: Jeff Fitzmyers <jeff(at)cloverpub(dot)com>
To: "david(at)shadovitz(dot)com" <david(at)shadovitz(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: COUNT & Pagination
Date: 2004-01-11 20:59:36
Message-ID: 107436B6-4479-11D8-BE00-000A959C6000@cloverpub.com (view raw or flat)
Thread:
Lists: pgsql-performance
> So I'm looking for advice on displaying paginated query results.
> Displaying 1 to 50 of 2905.
>   1-50 | 51-100 | 101-150 | etc.
>
> I do this by executing two queries.  One is of the form:
>   SELECT <select list> FROM <view/table list> WHERE <filter> LIMIT m 
> OFFSET n
> The other is identical except that I replace the select list with 
> COUNT(*).

This is the only way I know of how to do it.

> I'm running PG 7.2.2 and want to upgrade to 7.4.1.  I've never 
> upgraded PG
> before and I'm nervous.  Can I simply run pg_dumpall, install 7.4.1, 
> and then
> feed the dump into psql?

I would practice and play with it on another machine until you can do 
it easily. You will learn a lot and the experience might prove 
invaluable in may ways :-)

Jeff



In response to

pgsql-performance by date

Next:From: Christopher Kings-LynneDate: 2004-01-12 00:24:00
Subject: Re: Explain not accurate
Previous:From: CoLDate: 2004-01-11 20:01:18
Subject: Re: COUNT & Pagination

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group