Re: [HACKERS] Much Ado About COUNT(*)

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Much Ado About COUNT(*)
Date: 2005-01-13 11:34:30
Message-ID: 41E65CC6.8050901@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Merlin Moncure wrote:
> 6. for large tables, you can get a pretty accurate count by doing:
> select count(*) * 10 from t where random() > .9;
> on my setup, this shaved about 15% off of the counting time...YMMV.

That's an interesting idea, using sampling to get an estimate.

Thanks for the tip.

--
dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Együd Csaba 2005-01-13 12:33:16 pgsqlODBC problems
Previous Message sid tow 2005-01-13 11:23:15 problem with the select query

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Brown 2005-01-13 13:03:54 Re: [pgsql-hackers-win32] [BUGS] More SSL questions..
Previous Message Dave Page 2005-01-13 11:25:53 Re: looking for rh9 rpms for pgadmin v 1.2