aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-11-18 08:25:33 -0500
committerRobert Haas <rhaas@postgresql.org>2015-11-18 08:25:33 -0500
commitadeee974866085db84b860c1f397dd7c6b136a0a (patch)
tree48e20ad5ac46f3d9529899f22fc709b091d30241
parent5f10b7a604c87fc61a2c20a56552301f74c9bd5f (diff)
downloadpostgresql-adeee974866085db84b860c1f397dd7c6b136a0a.tar.gz
postgresql-adeee974866085db84b860c1f397dd7c6b136a0a.zip
Fix dumb bug in tqueue.c
When I wrote this code originally, the intention was to recompute the remapinfo only when the tupledesc changes. This presumably only happens once per query, but I copied the design pattern from other DestReceivers. However, due to a silly oversight on my part, tqueue->tupledesc never got set, leading to recomputation for every tuple. This should improve the performance of parallel scans that return a significant number of tuples. Report by Amit Kapila; patch by me, reviewed by him.
-rw-r--r--src/backend/executor/tqueue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/executor/tqueue.c b/src/backend/executor/tqueue.c
index 5735acf10e3..d625b0d800b 100644
--- a/src/backend/executor/tqueue.c
+++ b/src/backend/executor/tqueue.c
@@ -127,15 +127,15 @@ tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self)
* new tupledesc. This is a strange test both because the executor really
* shouldn't change the tupledesc, and also because it would be unsafe if
* the old tupledesc could be freed and a new one allocated at the same
- * address. But since some very old code in printtup.c uses this test, we
- * adopt it here as well.
+ * address. But since some very old code in printtup.c uses a similar
+ * test, we adopt it here as well.
*/
- if (tqueue->tupledesc != tupledesc ||
- tqueue->remapinfo->natts != tupledesc->natts)
+ if (tqueue->tupledesc != tupledesc)
{
if (tqueue->remapinfo != NULL)
pfree(tqueue->remapinfo);
tqueue->remapinfo = BuildRemapInfo(tupledesc);
+ tqueue->tupledesc = tupledesc;
}
tuple = ExecMaterializeSlot(slot);