Re: wip: functions median and percentile - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: wip: functions median and percentile
Date
Msg-id AANLkTimLRqYaSgbrEs2RoOJe2t-b8hP59vn0Ap8Mn5MT@mail.gmail.com
Whole thread Raw
In response to Re: wip: functions median and percentile  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 11 October 2010 19:05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Dean Rasheed <dean.a.rasheed@gmail.com> writes:
>> On 11 October 2010 18:48, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> And?  If the memory requirement actually fits, you're in good shape.
>
>> Yeah but the actual memory requirement, if it uses a hash aggregate,
>> is over 1GB, and could easily be much higher.
>
> In that case the estimate of 30K per instance was wrong.
> You still haven't explained why this is impossible to estimate,
> or even particularly hard, as long as we can provide some code that
> knows specifically about the behavior of this aggregate.  The amount
> of space needed to sort X amount of data is not unpredictable.
>

The estimate that's wrong is the number of rows that the SRF is going
to return. If I'm reading the plan right, the planner thinks that the
aggregate is going to be called 200 times on groups of 5 rows.
Actually, it's called 40000 times on groups of 1 row.

Regards,
Dean


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Which file does the SELECT?
Next
From: Greg Stark
Date:
Subject: Re: wip: functions median and percentile