Skip site navigation (1) Skip section navigation (2)

Re: count(*) slow on large tables

From: Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: Dror Matalon <dror(at)zapatec(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: count(*) slow on large tables
Date: 2003-10-03 06:29:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-performance
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.

Just another approach of achieving same thing.. Don't be religious about running 
a qeury from SQL prompt. That's it..


In response to


pgsql-performance by date

Next:From: shyamperiDate: 2003-10-03 06:34:38
Subject: A Basic Question
Previous:From: Gregory S. WilliamsonDate: 2003-10-03 06:22:46
Subject: Re: count(*) slow on large tables

pgsql-hackers by date

Next:From: Hannu KrosingDate: 2003-10-03 06:34:30
Subject: Re: Index/Function organized table layout
Previous:From: Greg StarkDate: 2003-10-03 05:13:08
Subject: Re: count(*) slow on large tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group