pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nikola Ivacic <nikola@rs-pi.com>
To: Ian Harding <ianh@tpchd.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: count(*) optimization
Date: Wed, 8 Jan 2003 18:06:03 +0100
Message-ID: <02cd01c2b738$39cc0a00$1100a8c0@rspi> (raw)
References: <se1bdfc6.092@mail.tpchd.org>

I am not sure pgAdmin uses count(*) and I didn't have time to check
phpPgAdmin also, I presumed it from similarly slow response I get in psql

Nikola

----- Original Message -----
From: "Ian Harding" <ianh@tpchd.org>
To: <nikola@rs-pi.com>; <bruno@wolff.to>
Cc: <PGSQL-sql@postgresql.org>
Sent: Wednesday, January 08, 2003 5:20 PM
Subject: Re: [SQL] count(*) optimization


Bummer.  I seem to remember PGAccess using the numbers generated by ANALYZE
to show the number of records.  I noticed it was inaccurate until you ran a
vaccum.  I guess pgAdmin chose accuracy over speed in this case.

Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding@tpchd.org
(253) 798-3549

>>> "Nikola Ivacic" <nikola@rs-pi.com> 01/08/03 08:15AM >>>
The problem is in other software I use,
witch uses count(*) function to display relation properties

pgAdmin II
phpPgAdmin

Nikola


----- Original Message -----
From: "Bruno Wolff III" <bruno@wolff.to>
To: "Nikola Ivacic" <nikola@rs-pi.com>
Cc: <pgsql-sql@postgresql.org>
Sent: Wednesday, January 08, 2003 5:22 PM
Subject: Re: [SQL] count(*) optimization


> On Wed, Jan 08, 2003 at 17:04:40 +0100,
>   Nikola Ivacic <nikola@rs-pi.com> wrote:
> > Hi
> >
> > I have trouble executing count(*) statement.
> > On a large dataset it takes quite a while to return result.
> > Is there any other way to get number of tupples in relation
> > or is the only way to optimize count() function to index it?
>
> Indexes won't help count.
>
> If you retrieve counts a lot more than you do updates that will change
their
> value, then you may want to keep the counts in another table and use
> triggers to keep them updated.
>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)






view thread (5+ messages)  latest in thread

Message-ID: <02cd01c2b738$39cc0a00$1100a8c0@rspi>
Permalink:  ../02cd01c2b738$39cc0a00$1100a8c0@rspi/
Also on:    postgresql.org/message-id/02cd01c2b738$39cc0a00$1100a8c0@rspi

 · 

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-sql@postgresql.org
  Cc: nikola@rs-pi.com, ianh@tpchd.org
  Subject: Re: count(*) optimization
  In-Reply-To: <02cd01c2b738$39cc0a00$1100a8c0@rspi>

* 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