From: Jonah H. Harris <jonah.harris@gmail.com>
To: 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 09:30:36 -0400
Message-ID: <36e682920705180630y2c28cdc5m14af94d6d62e1daf@mail.gmail.com> (raw)
In-Reply-To: <20070518131920.GA7069@it.is.rice.edu>
References: <133912.35849.qm@web56406.mail.re3.yahoo.com>
<20070518131920.GA7069@it.is.rice.edu>
On 5/18/07, Kenneth Marshall <ktm@rice.edu> wrote:
> Make a summary table and select from there instead.
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.
--
Jonah H. Harris, Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 3rd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
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: jonah.harris@gmail.com, ktm@rice.edu, rjessil@yahoo.com
Subject: Re: select count(*) from a large table is very slow
In-Reply-To: <36e682920705180630y2c28cdc5m14af94d6d62e1daf@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