Re: wip: functions median and percentile
Hitoshi Harada <umi.tanuki@gmail.com>
From: Hitoshi Harada <umi.tanuki@gmail.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, David Fetter <david@fetter.org>, Pavel Stehule <pavel.stehule@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-10-01T15:35:03Z
Lists: pgsql-hackers
2010/10/2 Kevin Grittner <Kevin.Grittner@wicourts.gov>: > 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, Maybe, but it still has memory problem if the values vary, right? And I'm not familiar with the algorithm of median other than what the current patch does, so I'm not sure if hash table solution can be made easily. Regards, -- Hitoshi Harada