From: Daniel Cristian Cruz <danielcristian@gmail.com>
To: Jonah H. Harris <jonah.harris@gmail.com>
Cc: Kenneth Marshall <ktm@rice.edu>
Cc: Jessica Richard <rjessil@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: select count(*) from a large table is very slow
Date: Fri, 18 May 2007 10:58:59 -0300
Message-ID: <48d0cacb0705180658n1ce65297xa9f28d56dd4f8426@mail.gmail.com> (raw)
In-Reply-To: <36e682920705180630y2c28cdc5m14af94d6d62e1daf@mail.gmail.com>
References: <133912.35849.qm@web56406.mail.re3.yahoo.com>
<20070518131920.GA7069@it.is.rice.edu>
<36e682920705180630y2c28cdc5m14af94d6d62e1daf@mail.gmail.com>
2007/5/18, Jonah H. Harris <jonah.harris@gmail.com>:
> Yes, a summary table updated by triggers is the only way to have
> correct numbers... but you also pay the overhead of maintaining those
> numbers on every INSERT/UPDATE statement. If you just need
> *reasonable* guesstimates, use reltuples in pg_class after an analyze.
Oops... INSERT or DELETE... :)
And remember that if using TRUNCATE, it will not run your trigger and
you will need to reset the counter manually.
Regards...
--
Daniel Cristian Cruz
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-admin@postgresql.org
Cc: danielcristian@gmail.com, jonah.harris@gmail.com, ktm@rice.edu, rjessil@yahoo.com
Subject: Re: select count(*) from a large table is very slow
In-Reply-To: <48d0cacb0705180658n1ce65297xa9f28d56dd4f8426@mail.gmail.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