postgresql/src
David Rowley d37aa3d358 Allow nodeSort to perform Datum sorts for byref types
Here we add a new 'copy' parameter to tuplesort_getdatum so that we can
instruct the function not to datumCopy() byref Datums before returning.

Similar to 91e9e89dc, this can provide significant performance
improvements in nodeSort when sorting by a single byref column and the
sort's targetlist contains only that column.

This allows us to re-enable Datum sorts for byref types which was disabled
in 3a5817695 due to a reported memory leak.

Additionally, here we slightly optimize DISTINCT aggregates so that we no
longer perform any datumCopy() when we find the current value not to be
distinct from the previous value.  Previously the code would always take a
copy of the most recent Datum and pfree the previous value, even when the
values were the same.  Testing shows a small but noticeable performance
increase when aggregate transitions are skipped due to the current
transition value being the same as the prior one.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvqS6wC5U==k9Hd26E4EQXH3QR67-T4=Q1rQ36NGvjfVSg@mail.gmail.com
Discussion: https://postgr.es/m/CAApHDvqHonfe9G1cVaKeHbDx70R_zCrM3qP2AGXpGrieSKGnhA@mail.gmail.com
2022-10-28 09:25:12 +13:00
..
backend Allow nodeSort to perform Datum sorts for byref types 2022-10-28 09:25:12 +13:00
bin Improve tab completion for ALTER STATISTICS <name> SET in psql 2022-10-24 15:46:42 +09:00
common Move pg_pwritev_with_retry() to src/common/file_utils.c 2022-10-27 14:39:42 +09:00
fe_utils meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
include Allow nodeSort to perform Datum sorts for byref types 2022-10-28 09:25:12 +13:00
interfaces libpq: Reset singlerow flag correctly in pipeline mode 2022-10-14 19:06:26 +02:00
makefiles autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
pl Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
port Fix unlink() for STATUS_DELETE_PENDING on Windows. 2022-10-25 16:26:58 +13:00
template Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
test Avoid making commutatively-duplicate clauses in EquivalenceClasses. 2022-10-27 14:42:18 -04:00
timezone meson: Add windows resource files 2022-10-05 09:56:05 -07:00
tools Remove pgpid_t type, use pid_t instead 2022-10-22 10:45:19 +02:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Make finding openssl program a configure or meson option 2022-10-20 21:05:42 +02:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00