pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeremiah Jahn <jeremiah@cs.earlham.edu>
To: Dave Held <dave.held@arrayservicesgrp.com>
Cc: John A Meinel <john@arbash-meinel.com>
Cc: postgres performance <pgsql-performance@postgresql.org>
Subject: Re: name search query speed
Date: Thu, 03 Mar 2005 14:47:29 -0600
Message-ID: <1109882849.16326.99.camel@bluejay.goodinassociates.com> (raw)
In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F90261845D@asg002.asg.local>
References: <49E94D0CFCD4DB43AFBA928DDD20C8F90261845D@asg002.asg.local>

doesn't that cause two queries? I used to do it that way and cut my time
substantially by counting in-line. Even though the results were cached
it still took more time. Also since the tables is constantly be updated
the returned total would not always match the number of results on the
second query.

On Thu, 2005-03-03 at 14:26 -0600, Dave Held wrote:
> > -----Original Message-----
> > From: Jeremiah Jahn [mailto:jeremiah@cs.earlham.edu]
> > Sent: Thursday, March 03, 2005 2:15 PM
> > To: John A Meinel
> > Cc: postgres performance
> > Subject: Re: [PERFORM] name search query speed
> > 
> > [...]
> > So the count for this is generated on the fly needed for
> > pagination in the app which expresses the total number of
> > finds, but only displays 40 of them. If any one knows a way
> > to determine the total number of matches without needing to 
> > iterate through them using jdbc, I'm all ears as this would
> > save me huge amounts of time and limit/offset would become
> > an option. 
> 
> Is there a reason you can't do a count(field) query first?  If
> so, you can get the number of records returned by setting
> absolute(-1) and getting the row number.
> 
> __
> David B. Held
> Software Engineer/Array Services Group
> 200 14th Ave. East,  Sartell, MN 56377
> 320.534.3637 320.253.7800 800.752.8129
-- 
"A power so great, it can only be used for Good or Evil!"
                -- Firesign Theatre, "The Giant Rat of Summatra"




view thread (14+ messages)  latest in thread

Message-ID: <1109882849.16326.99.camel@bluejay.goodinassociates.com>
Permalink:  ../1109882849.16326.99.camel@bluejay.goodinassociates.com/
Also on:    postgresql.org/message-id/1109882849.16326.99.camel@bluejay.goodinassociates.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: jeremiah@cs.earlham.edu, dave.held@arrayservicesgrp.com, john@arbash-meinel.com
  Subject: Re: name search query speed
  In-Reply-To: <1109882849.16326.99.camel@bluejay.goodinassociates.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