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

Re: Performance of count(*)

From: Michael Stone <mstone+postgres(at)mathom(dot)us>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance of count(*)
Date: 2007-03-22 14:18:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Thu, Mar 22, 2007 at 01:30:35PM +0200, ismo(dot)tuononen(at)solenovo(dot)fi wrote:
>approximated count?????
>why? who would need it? where you can use it?

Do a google query. Look at the top of the page, where it says 
"results N to M of about O". For user interfaces (which is where a lot 
of this count(*) stuff comes from) you quite likely don't care about the 
exact count, because the user doesn't really care about the exact count. 

IIRC, that's basically what you get with the mysql count anyway, since 
there are corner cases for results in a transaction. Avoiding those 
cases is why the postgres count takes so long; sometimes that's what's 
desired and sometimes it is not.

Mike Stone

In response to


pgsql-performance by date

Next:From: Jonah H. HarrisDate: 2007-03-22 14:33:29
Subject: Re: Performance of count(*)
Previous:From: Alvaro HerreraDate: 2007-03-22 13:52:05
Subject: Re: Parallel Vacuum

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