postgresql/src/backend
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
..
access Allow nodeSort to perform Datum sorts for byref types 2022-10-28 09:25:12 +13:00
backup Rename shadowed local variables 2022-10-05 21:01:41 +13:00
bootstrap Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
catalog Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
commands Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION 2022-10-18 11:46:58 +02:00
executor Allow nodeSort to perform Datum sorts for byref types 2022-10-28 09:25:12 +13:00
foreign Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
jit Track LLVM 15 changes. 2022-10-19 22:18:26 +13:00
lib meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
libpq Fix variable assignment thinko in hba.c 2022-10-26 12:57:40 +09:00
main meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nodes Use proper macro to access TransactionId 2022-10-20 09:41:03 +02:00
optimizer Avoid making commutatively-duplicate clauses in EquivalenceClasses. 2022-10-27 14:42:18 -04:00
parser Update some comments that should've covered MERGE 2022-10-24 12:52:43 +02:00
partitioning Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
po meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
port meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
postmaster Rework shutdown callback of archiver modules 2022-10-19 14:06:56 +09:00
regex Remove uses of register due to incompatibility with C++17 and up 2022-09-24 12:08:37 -07:00
replication Clean up some GUC declarations and comments 2022-10-25 14:06:07 +09:00
rewrite Reject non-ON-SELECT rules that are named "_RETURN". 2022-10-17 12:14:39 -04:00
snowball meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
statistics Rename shadowed local variables 2022-10-05 21:01:41 +13:00
storage Move pg_pwritev_with_retry() to src/common/file_utils.c 2022-10-27 14:39:42 +09:00
tcop Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
tsearch Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
utils Allow nodeSort to perform Datum sorts for byref types 2022-10-28 09:25:12 +13:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Move gramparse.h to src/backend/parser 2022-09-14 10:57:13 +07:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00