mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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.
This commit is contained in:
@ -127,15 +127,15 @@ tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self)
|
|||||||
* new tupledesc. This is a strange test both because the executor really
|
* 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
|
* 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
|
* 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
|
* address. But since some very old code in printtup.c uses a similar
|
||||||
* adopt it here as well.
|
* test, we adopt it here as well.
|
||||||
*/
|
*/
|
||||||
if (tqueue->tupledesc != tupledesc ||
|
if (tqueue->tupledesc != tupledesc)
|
||||||
tqueue->remapinfo->natts != tupledesc->natts)
|
|
||||||
{
|
{
|
||||||
if (tqueue->remapinfo != NULL)
|
if (tqueue->remapinfo != NULL)
|
||||||
pfree(tqueue->remapinfo);
|
pfree(tqueue->remapinfo);
|
||||||
tqueue->remapinfo = BuildRemapInfo(tupledesc);
|
tqueue->remapinfo = BuildRemapInfo(tupledesc);
|
||||||
|
tqueue->tupledesc = tupledesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
tuple = ExecMaterializeSlot(slot);
|
tuple = ExecMaterializeSlot(slot);
|
||||||
|
Reference in New Issue
Block a user