Avoid a useless tuple copy within nodeMaterial. Neil Conway
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 23 Mar 2008 00:54:04 +0000 (00:54 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 23 Mar 2008 00:54:04 +0000 (00:54 +0000)
src/backend/executor/nodeMaterial.c

index 6498fd5934ce1085d20968f9951fd02e26589b39..422dcbd300091a2daff4fe2cab7b93c1eed55f45 100644 (file)
@@ -124,18 +124,17 @@ ExecMaterial(MaterialState *node)
                }
 
                /*
-                * Append returned tuple to tuplestore.  NOTE: because the tuplestore
-                * is certainly in EOF state, its read position will move forward over
-                * the added tuple.  This is what we want.
+                * Append a copy of the returned tuple to tuplestore.  NOTE: because
+                * the tuplestore is certainly in EOF state, its read position will
+                * move forward over the added tuple.  This is what we want.
                 */
                if (tuplestorestate)
                        tuplestore_puttupleslot(tuplestorestate, outerslot);
 
                /*
-                * And return a copy of the tuple.      (XXX couldn't we just return the
-                * outerslot?)
+                * We can just return the subplan's returned tuple, without copying.
                 */
-               return ExecCopySlot(slot, outerslot);
+               return outerslot;
        }
 
        /*