Re: Improving count(*)

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improving count(*)
Date: 2005-11-18 00:34:02
Message-ID: D425483C2C5C9F49B5B7A41F8944154757D2E9@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> owner(at)postgresql(dot)org] On Behalf Of Tom Lane
> Sent: Thursday, November 17, 2005 4:17 PM
> To: Simon Riggs
> Cc: Kevin Grittner; pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Improving count(*)
>
> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> > From here, another proposal. We have a GUC called
count_uses_estimate
> > that is set to off by default. If set to true, then a count(*) will
use
> > the planner logic to estimate number of rows in the table and return
> > that as the answer, rather than actually count the row.
>
> Ugh. Why not just provide a function to retrieve the planner
estimate,
> but *not* call it count(*)? It would fit nicely with the
contrib/dbsize
> stuff (or I should say, the stuff formerly in dbsize...)

An estimate of the number of rows would be nice to have.
A function called cardinality_estimate() or something of that nature
seems more natural than count(*)

Browse pgsql-hackers by date

  From Date Subject
Next Message mark 2005-11-18 00:48:13 Re: Improving count(*)
Previous Message Tom Lane 2005-11-18 00:17:15 Re: Improving count(*)