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

Re: wip: functions median and percentile

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wip: functions median and percentile
Date: 2010-10-11 18:23:25
Message-ID: AANLkTimLRqYaSgbrEs2RoOJe2t-b8hP59vn0Ap8Mn5MT@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-rrreviewers
On 11 October 2010 19:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
>> On 11 October 2010 18:48, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

pgsql-hackers by date

Next:From: Greg StarkDate: 2010-10-11 18:27:13
Subject: Re: wip: functions median and percentile
Previous:From: David FetterDate: 2010-10-11 18:18:50
Subject: Re: Which file does the SELECT?

pgsql-rrreviewers by date

Next:From: Greg StarkDate: 2010-10-11 18:27:13
Subject: Re: wip: functions median and percentile
Previous:From: Tom LaneDate: 2010-10-11 18:05:11
Subject: Re: wip: functions median and percentile

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