Re: *sigh*

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: Randolf Richardson <rr(at)8x(dot)ca>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: *sigh*
Date: 2003-12-29 08:35:32
Message-ID: 3FEFE754.5060104@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

*growl* - it sounds like the business...and I was all set to code it,
however after delving into Pg's aggregation structure a bit, it suffers
a fatal flaw :

There appears to be no way to avoid visiting every row when defining an
aggregate (even if you do nothing on each one) -- which defeats the
whole point of my suggestion (i.e avoiding the visit to every row)

To make the original idea work requires amending the definition of Pg
aggregates to introduce "fake" aggregates that don't actually get
evaulated for every row. At this point I am not sure if this sort of
modification is possible or reasonable - others who know feel free to
chip in :-)

regards

Mark

Randolf Richardson wrote:

>"markir(at)paradise(dot)net(dot)nz (Mark Kirkwood)" wrote in
>comp.databases.postgresql.hackers:
>
>[sNip]
>
>
>>How about:
>>
>>Implement a function "estimated_count" that can be used instead of
>>"count". It could use something like the algorithm in
>>src/backend/commands/analyze.c to get a reasonably accurate psuedo count
>>quickly.
>>
>>The advantage of this approach is that "count" still means (exact)count
>>(for your xact snapshot anyway). Then the situation becomes:
>>
>>Want a fast count? - use estimated_count(*)
>>Want an exact count - use count(*)
>>
>>
>
> I think this is an excellent solution.
>
>
>

In response to

  • Re: *sigh* at 2003-12-12 19:43:55 from Randolf Richardson

Responses

  • Re: *sigh* at 2003-12-29 10:33:58 from Simon Riggs

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2003-12-29 08:45:15 Re: Is my MySQL Gaining ?
Previous Message Pavel Stehule 2003-12-29 08:31:09 Re: Error with returning SETOF Record