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

Re: Newbie question: ultra fast count(*)

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Rodrigo Madera" <rodrigo(dot)madera(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Newbie question: ultra fast count(*)
Date: 2005-11-28 13:31:06
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3417DD965@Herge.rcsinc.local (view raw or flat)
Thread:
Lists: pgsql-performance
> I have been reading all this technical talk about costs and such that
> I don't (_yet_) understand.
> 
> Now I'm scared... what's the fastest way to do an equivalent of
> count(*) on a table to know how many items it has?

Make sure to analyze the database frequently and check pg_class for
reltuples field.  This gives 0 time approximations of # row in table at
the time of the last analyze.

Many other approaches...check archives.  Also your requirements are
probably not as high as you think they are ;)

Merlin


pgsql-performance by date

Next:From: Luke LonerganDate: 2005-11-28 16:26:21
Subject: Re: Hardware/OS recommendations for large databases (
Previous:From: David LangDate: 2005-11-28 04:01:05
Subject: Re: Hardware/OS recommendations for large databases (

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