pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roberto Mello <rmello@cc.usu.edu>
To: pgsql-sql@postgresql.org
Subject: Re: how many rows? [was Re: fetching rows]]
Date: Fri, 17 Nov 2000 17:11:03 -0700
Message-ID: <3A15C917.E3252F9@cc.usu.edu> (raw)

"Robert B. Easter" wrote:

> If someone has done it a better way, I'd like to hear how.  However,
> sometimes it is possible to cache a count(*) value somewhere in the database
> so it doesn't have to be found everytime - it depends on your database and
> what the select is if you can store the count in advance somehow.

	I don't know how it was implemented (source code is available), but the
PostgreSQL driver for AOLserver (a kick-butt web server for
database-backed websites) has a function that does that. All I do after
a SQL statement is:

	set rowcount [ns_pg ntuples]

	in my Tcl code and there it is. The driver is available at either
http://www.aolserver.com or http://www.openacs.org (the latter has a
more elaborate version of the driver).

	-Roberto
-- 
Computer Science			Utah State University
Space Dynamics Laboratory		Web Developer
USU Free Software & GNU/Linux Club 	http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto



view thread (4+ messages)  latest in thread

Message-ID: <3A15C917.E3252F9@cc.usu.edu>
Permalink:  ../3A15C917.E3252F9@cc.usu.edu/
Also on:    postgresql.org/message-id/3A15C917.E3252F9@cc.usu.edu

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: rmello@cc.usu.edu
  Subject: Re: how many rows? [was Re: fetching rows]]
  In-Reply-To: <3A15C917.E3252F9@cc.usu.edu>
  References: <3A15C917.E3252F9@cc.usu.edu>

* 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