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

From Kevin Grittner
Subject Re: wip: functions median and percentile
Date
Msg-id 4CA5B4A70200002500036331@gw.wicourts.gov
Whole thread Raw
In response to Re: wip: functions median and percentile  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: wip: functions median and percentile
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Hitoshi Harada <umi.tanuki@gmail.com> writes:
>> Another suggestion?
> 
> The implementation I would've expected to see is to do the sort
> and then have two code paths for retrieving the median, depending
> on whether the sort result is all in memory or not.
Would it make sense to accumulate value/count pairs in a hash table,
along with a total count, as the tuples are encountered, and sort
the (potentially smaller) hash table at the end?  (Not that this
helps with the memory management questions...)  Large sets with any
significant degree of duplication in values (say the age in years of
residents of a state) would probably run significantly faster this
way.
-Kevin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: wip: functions median and percentile
Next
From: Hitoshi Harada
Date:
Subject: Re: wip: functions median and percentile