Re: Use quick select instead of qsort to get median

2021-07-22 Thread John Naylor
On Thu, Jul 22, 2021 at 8:07 AM houzj.f...@fujitsu.com < houzj.f...@fujitsu.com> wrote: > > Hi, > > When I was writing an extension which need to get the median of an array, I > tried to find if postgres provide some api that can do that. I found all the > places in postgres invoke qsort() and then

Use quick select instead of qsort to get median

2021-07-22 Thread houzj.f...@fujitsu.com
Hi, When I was writing an extension which need to get the median of an array, I tried to find if postgres provide some api that can do that. I found all the places in postgres invoke qsort() and then get the median. I was thinking can we do better by using "quick select" and is it worth it. Curre