pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: david@shadovitz.com <david@shadovitz.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: COUNT & Pagination
Date: Mon, 12 Jan 2004 10:16:37 +0000
Message-ID: <200401121016.37918.dev@archonet.com> (raw)
In-Reply-To: <01C3D82B.388A7FE0.david@shadovitz.com>
References: <01C3D82B.388A7FE0.david@shadovitz.com>

On Sunday 11 January 2004 18:10, David Shadovitz wrote:
> I understand that COUNT queries are expensive.  So I'm looking for advice
> on displaying paginated query results.
>
> I display my query results like this:
>
>   Displaying 1 to 50 of 2905.
>   1-50 | 51-100 | 101-150 | etc.
>
> I do this by executing two queries.

If you only need the count when you've got the results, most PG client 
interfaces will tell you how many rows you've got. What language is your app 
in?

-- 
  Richard Huxton
  Archonet Ltd



view thread (13+ messages)  latest in thread

Message-ID: <200401121016.37918.dev@archonet.com>
Permalink:  ../200401121016.37918.dev@archonet.com/
Also on:    postgresql.org/message-id/200401121016.37918.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, david@shadovitz.com
  Subject: Re: COUNT & Pagination
  In-Reply-To: <200401121016.37918.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox