Re: Assorted leaks and weirdness in parallel execution
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-08-31T19:08:37Z
Lists: pgsql-hackers
On Thu, Aug 31, 2017 at 2:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Yeah, it is different. What I'm looking at is that nodeGather does > DestroyTupleQueueReader as soon as it's seen EOF on a given tuple queue. > That can't save any worker cycles. The reason seems to be that it wants > to collapse its array of TupleQueueReader pointers so only live queues are > in it. That's reasonable, but I'm inclined to implement it by making the > Gather node keep a separate working array of pointers to only the live > TupleQueueReaders. The ParallelExecutorInfo would keep the authoritative > array of all TupleQueueReaders that have been created, and destroy them in > ExecParallelFinish. Hmm, that's a thought. > Your point is that we want to shut down the TupleQueueReaders immediately > on rescan, which we do already. Another possible scenario is to shut them > down once we've reached the passed-down tuple limit (across the whole > Gather, not per-child which is what 3452dc524 implemented). I don't think > what I'm suggesting would complicate that. Yeah. I think the way to do that would be to implement what is mentioned in the comment for ExecShutdownNode: call that function on the child plan as soon as the LIMIT is filled. (Hmm, the reference to someday covering FDW in the header of that comment is obsolete, isn't it? Another oversight on my part.) -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Improve division of labor between execParallel.c and nodeGather[Merge].c.
- 51daa7bdb39e 11.0 landed
- 01edb5c7fc3b 10.0 landed
-
Avoid memory leaks when a GatherMerge node is rescanned.
- 2d44c58c79ae 11.0 landed
- 7610547c95f3 10.0 landed
-
Clean up shm_mq cleanup.
- b4fa938e9f48 10.0 landed
- 6708e447efb5 11.0 landed