Remove tuplesort_set_allowbounded() and adjust tuplesort_reset() tuplesort_set_allowbounded() was added to resolve an issue where a Tuplesortstate was created without TUPLESORT_ALLOWBOUNDED, but a later scan of Incremental Sort requires that flag because that scan is bounded. The new function was added in the backbranches as it's not possible to modify the signature of tuplesort_reset() there. Since we're free to adjust that in master, this commit gets rid of tuplesort_set_allowbounded(), which had to be called before tuplesort_reset(), and instead adds a new boolean parameter to tuplesort_reset() to allow the flag to be adjusted. This is a much cleaner API.
The fundamental difference between TUPLESORT_ALLOWBOUNDED and not having that flag is that the tuplecontext uses an AllocSet context for bounded sorts as the sort only needs to keep the top N tuples and pfrees any tuples that sort below those. When no bound is required, tuplecontext uses a Bump context, which does not support pfree(), but uses less memory to store the same tuples. Author: David Rowley <[email protected]> Discussion: https://postgr.es/m/caaphdvpojenkm2o2auplynyv-o9cg+zhpur3jimr+q0ca7n...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d9c6f22c3b2beaf34e47cf47fd21703886be8011 Modified Files -------------- src/backend/executor/nodeIncrementalSort.c | 18 ++++++----------- src/backend/utils/sort/tuplesort.c | 32 +++++++++++++----------------- src/include/utils/tuplesort.h | 4 +--- 3 files changed, 21 insertions(+), 33 deletions(-)
