Re: count(*) slow on large tables - Mailing list pgsql-performance

From Christopher Kings-Lynne
Subject Re: count(*) slow on large tables
Date
Msg-id 3F7E94DC.9090709@familyhealth.com.au
Whole thread Raw
In response to Re: count(*) slow on large tables  (Jeff <threshar@torgo.978.org>)
List pgsql-performance
> On our message boards each post is a row.  The powers that be like to know
> how many posts there are total (In addition to 'today')-
> select count(*) from posts is how it has been
> done on our informix db.  With our port to PG I instead select reltuples
> pg_class.

We have exactly the same situation, except we just added a 'num_replies'
field to each thread and a 'num_posts' field to each forum, so that
getting that information out is a very fast operation.  Because, of
course, there are hundreds of times more reads of that information than
writes...

Chris


pgsql-performance by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: [HACKERS] Index/Function organized table layout (from Re:
Next
From: Jeff
Date:
Subject: Re: Tuning/performance issue...