Hacker News new | past | comments | ask | show | jobs | submit login
Sort improvements in PostgreSQL since 1997 [pdf] (postgresql.org)
36 points by postila on Feb 16, 2016 | hide | past | favorite | 8 comments



  Using SIMD instructions (MMX/SSE/AVX)
  ○ Most operators limited to floats but recently more general purpose (integer) vector operations have been supported
  ○ Registers keep increasing in size -- the next generation of CPUs will have 512 byte registers which may be sufficient
Nobody uses MMX these days, SSE and AVX are not mostly limited to floating point, and AVX-512 is 512 bits, not bytes.


Good point. Will correct the "byte" error. Thanks.


why not radix sort? (or some variant of it)


It's mentioned, albeit in the second-last line of the whole presentation, as a possible reaction to GPU-based sorting in the future.


Ok. Because you can radix sort on CPU and it's a lot faster than e.g. quicksort in my experience.


Postgres has an extensible type system so Radix sort isn't really suitable, it really needs a comparison sort.

For SSE/MMX/AVX/etc or GPU sorts it would have to use integer or floating point surrogate keys. It would probably be the same abbreviated keys mentioned in the last few slides. That could be a radix sort but generally I think bitonic sort is preferred.


> Postgres has an extensible type system so Radix sort isn't really suitable, it really needs a comparison sort.

That's not quite true. It supports string tries, for example (using SP-GIST). Such operations just have to be built for specific types. I think it would be more accurate to say that (AFAICT) Postgres doesn't currently have any way to extend the optimizer with custom plans (though it's been a very popular feature suggestion).


> I think it would be more accurate to say that (AFAICT) Postgres doesn't currently have any way to extend the optimizer with custom plans (though it's been a very popular feature suggestion).

There's http://www.postgresql.org/docs/devel/static/custom-scan.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: