Teach tuplestore.c to throw away data before the "mark" point when the caller
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 21 May 2007 17:57:35 +0000 (17:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 21 May 2007 17:57:35 +0000 (17:57 +0000)
commitfe46158b5f852da45537bb786b59dd1da139fdcd
tree478abb9d47339d5e62104abbadb7105f3667b207
parent5db9ea4e3bb8ff406a30cb84a06d849d54b07d2c
Teach tuplestore.c to throw away data before the "mark" point when the caller
is using mark/restore but not rewind or backward-scan capability.  Insert a
materialize plan node between a mergejoin and its inner child if the inner
child is a sort that is expected to spill to disk.  The materialize shields
the sort from the need to do mark/restore and thereby allows it to perform
its final merge pass on-the-fly; while the materialize itself is normally
cheap since it won't spill to disk unless the number of tuples with equal
key values exceeds work_mem.

Greg Stark, with some kibitzing from Tom Lane.
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMergejoin.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/plan/createplan.c
src/backend/utils/sort/tuplestore.c
src/include/nodes/execnodes.h
src/include/optimizer/cost.h
src/include/utils/tuplestore.h