Re: hyrax vs. RelationBuildPartitionDesc
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-13T18:36:13Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > You do? Unless I misunderstood, your options are: > 1. (the patch you attached) create a temporary memory context that is > used for everything, then at the end copy the good stuff to CacheMemCxt > (or a sub-context thereof). This still needs to copy. > 2. create a temp memory context, do everything there, do retail freeing > of everything we don't want, reparenting the context to CacheMemCxt. > Hope we didn't forget to pfree anything. > How is any of those superior to what I propose? I doubt that what you're suggesting is terribly workable. It's not just RelationBuildPartitionDesc that's at issue. Part of what will be the long-lived data structure is made by partition_bounds_create, and that invokes quite a boatload of code that both makes the final data structure and leaks a lot of intermediate junk. Having to be very careful about permanent vs temporary data throughout all of that seems like a recipe for bugs. The existing code in RelationBuildPartitionDesc is already pretty good about avoiding copying of data other than the output of partition_bounds_create. In fact, I think it's already close to what you're suggesting other than that point. So I think --- particularly given that we need something we can back-patch into v11 --- that we shouldn't try to do anything much more complicated than what Robert is suggesting. regards, tom lane
Commits
-
Load relcache entries' partitioning data on-demand, not immediately.
- 5b9312378e2f 13.0 landed
-
Prevent memory leaks associated with relcache rd_partcheck structures.
- d4c50b4b1f86 10.8 landed
- 5f1433ac5e7f 12.0 landed
- 089e4d405d0f 11.3 landed
-
Don't copy PartitionBoundInfo in set_relation_partition_info.
- c8151e642368 12.0 landed
-
Further reduce memory footprint of CLOBBER_CACHE_ALWAYS testing.
- d3f48dfae42f 12.0 landed
-
Fix some oversights in commit 2455ab488.
- de570047993b 12.0 landed
-
Defend against leaks into RelationBuildPartitionDesc.
- 2455ab48844c 12.0 landed
-
Allow ATTACH PARTITION with only ShareUpdateExclusiveLock.
- 898e5e3290a7 12.0 cited