Re: count(*) slow on large tables

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Christopher Browne <cbbrowne(at)libertyrms(dot)info>, Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: count(*) slow on large tables
Date: 2003-10-05 19:11:50
Message-ID: 1065381109.23288.196.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

> And for those GUIs, wouldn't it be 97% as good to run an ANALYZE and give the
> approximate record counts for large tables?

Interfaces which run a COUNT(*) like that are broken by design. They
fail to consider the table may really be a view which of course could
not be cached with results like that and may take days to load a full
result set (we had some pretty large views in an old billing system).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-10-05 19:41:15 Re: PQfnumber and quoted identifiers
Previous Message Tom Lane 2003-10-05 18:59:08 Re: Open 7.4 items

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2003-10-05 21:57:42 Re: reindex/vacuum locking/performance?
Previous Message Josh Berkus 2003-10-05 18:57:21 Re: count(*) slow on large tables