Do no reset bounded before incremental sort rescan
authorTomas Vondra <tomas.vondra@postgresql.org>
Sat, 9 May 2020 17:41:36 +0000 (19:41 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Sat, 9 May 2020 17:41:36 +0000 (19:41 +0200)
ExecReScanIncrementalSort was resetting bounded=false, which means the
optimization would be disabled on all rescans. This happens because
ExecSetTupleBound is called before the rescan, not after it.

Author: James Coleman
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/20200414065336.GI1492@paquier.xyz

src/backend/executor/nodeIncrementalSort.c

index ae7ad5d7bde31fdf5e2e297fc98b9356876a1c0a..bfc2e4cf6b1d4741863375437ae440bf77985129 100644 (file)
@@ -1142,7 +1142,6 @@ ExecReScanIncrementalSort(IncrementalSortState *node)
    if (node->transfer_tuple != NULL)
        ExecClearTuple(node->transfer_tuple);
 
-   node->bounded = false;
    node->outerNodeDone = false;
    node->n_fullsort_remaining = 0;
    node->bound_Done = 0;