Re: Parallel bitmap heap scan
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>,
Haribabu Kommi <kommi.haribabu@gmail.com>, Rafia Sabih <rafia.sabih@enterprisedb.com>,
tushar <tushar.ahuja@enterprisedb.com>, Amit Khandekar <amitdkhan.pg@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, Andres Freund <andres@anarazel.de>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-02-20T17:48:34Z
Lists: pgsql-hackers
On Mon, Feb 20, 2017 at 5:55 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote: > On Sun, Feb 19, 2017 at 9:59 PM, Dilip Kumar <dilipbalaut@gmail.com> wrote: >> So basically, what I want to propose is that Only during >> ExecReScanBitmapHeapScan we can free all the DSA pointers because at >> that time we can be sure that all the workers have completed there >> task and we are safe to free. (And we don't free any DSA memory at >> ExecEndBitmapHeapScan). > > I think this works. OK. > Some hand-wavy thoughts on this topic in the context of hash joins: > > The argument for cleaning up sooner rather than later would be that it > could reduce the total peak memory usage of large execution plans. Is > that a reasonable goal and can we achieve it? I suspect the answer is > yes in theory but no in practice, and we don't even try to achieve it > in non-parallel queries as far as I know. We're pretty stupid about causing nodes to stop eating up resources as early as we could; for example, when a Limit is filled, we don't make any attempt to have scans underneath it release pins or memory or anything else. But we don't usually let the same node consume memory multiple times. ExecReScanBitmapHeapScan frees all of the memory used for the previous bitmap in the non-parallel case, so it should probably do that in the parallel case also. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Pass DSA_ALLOC_HUGE when allocating a shared TIDBitmap.
- a171f01501e1 10.0 landed
-
Support parallel bitmap heap scans.
- f35742ccb7aa 10.0 landed
-
tidbitmap: Support shared iteration.
- 98e6e89040a0 10.0 landed
-
Shut down Gather's children before shutting down Gather itself.
- acf555bc53ac 10.0 landed
-
Revise the way the element allocator for a simplehash is specified.
- c3c4f6e1740b 10.0 cited
-
Refactor bitmap heap scan estimation of heap pages fetched.
- da08a6598973 10.0 landed
-
Use more efficient hashtable for tidbitmap.c to speed up bitmap scans.
- 75ae538bc316 10.0 cited