Re: Use generation context to speed up tuplesorts
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Andres Freund <andres@anarazel.de>, Tomas Vondra <tv@fuzzy.cz>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-08-02T11:17:48Z
Lists: pgsql-hackers
On Sat, 31 Jul 2021 at 14:34, Tomas Vondra <tomas.vondra@enterprisedb.com> wrote: > I spent a bit of time hacking on the Generation context, adding the two > improvements discussed in this thread: > > 1) internal handling of block sizes, similar to what AllocSet does (it > pretty much just copies parts of it) > > 2) keeper block (we keep one empry block instead of freeing it) > > 3) I've also added allocChunkLimit, which makes it look a bit more like > AllocSet (instead of using just blockSize/8, which does not work too > well with dynamic blockSize) > > I haven't done any extensive tests on it, but it does pass check-world > with asserts etc. I haven't touched the comments, those need updating. > regards Thanks for starting work on that. I've only had a quick look, but I can have a more detailed look once you've got it more complete. For now it does not really look like the keeper block stuff is wired up the same way as in aset.c. I'd expect you to be allocating that in the same malloc as you're using to allocate the context struct itself in GenerationContextCreate(). Also, likely as a result of the above, minContextSize does not seem to be wired up to anything apart from an Assert(). David
Commits
-
Use Generation memory contexts to store tuples in sorts
- 40af10b571bd 15.0 landed
-
Adjust tuplesort API to have bitwise option flags
- 77bae396df3f 15.0 landed
-
Improve the generation memory allocator
- 1b0d9aa4f728 15.0 landed