From: Harald Fuchs <nospam@sap.com>
To: pgsql-performance@postgresql.org
Subject: Re: count(*) slow on large tables
Date: 06 Oct 2003 17:08:36 +0200
Message-ID: <pupthae74b.fsf@srv.protecting.net> (raw)
References: <20031002191547.GZ87525@rlx11.zapatec.com>
<20031002193905.GD18417@wolff.to>
<3F7C98B8.C892D0E5@nsd.ca>
<60brszcng5.fsf@dev6.int.libertyrms.info>
<20031002223313.GE87525@rlx11.zapatec.com>
<m3vfr7f4z1.fsf@wolfe.cbbrowne.com>
<20031003042754.GH87525@rlx11.zapatec.com>
<3F7D172E.3060107@persistent.co.in>
In article <3F7D172E.3060107@persistent.co.in>,
Shridhar Daithankar <shridhar_daithankar@persistent.co.in> writes:
> Dror Matalon wrote:
>> I smell a religious war in the aii:-). Can you go several days in a
>> row without doing select count(*) on any
>> of your tables? I suspect that this is somewhat a domain specific
>> issue. In some areas
>> you don't need to know the total number of rows in your tables, in
>> others you do.
> If I were you, I would have an autovacuum daemon running and rather
> than doing select count(*), I would look at stats generated by
> vacuums. They give approximate number of tuples and it should be good
> enough it is accurate within a percent.
The stats might indeed be a good estimate presumed there were not many
changes since the last VACUUM. But how about a variant of COUNT(*)
using an index? It would not be quite exact since it might contain
tuples not visible in the current transaction, but it might be a much
better estimate than the stats.
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: nospam@sap.com
Subject: Re: count(*) slow on large tables
In-Reply-To: <pupthae74b.fsf@srv.protecting.net>
* 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