Re: hyrax vs. RelationBuildPartitionDesc
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-04-13T15:53:39Z
Lists: pgsql-hackers
Amit Langote <amitlangote09@gmail.com> writes: > On Sat, Apr 13, 2019 at 4:47 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> I concluded that that's not parenthetical but pretty relevant... > Hmm, do you mean we should grow the same "keep_" logic for > rd_partcheck as we have for rd_partkey and rd_partdesc? I don't see > it in the updated patch though. No, the "keep_" stuff is only necessary when we're trying to preserve data structures in-place, which is only important if non-relcache code might be using pointers to it. Since rd_partcheck is never directly accessed by external code, only copied, there can't be any live pointers to it to worry about. Besides which, since it's load on demand rather than something that RelationBuildDesc forces to be valid immediately, any comparison would be guaranteed to fail: the field in the new reldesc will always be empty at this point. Perhaps there's an argument that it should be load-immediately not load-on-demand, but that would be an optimization not a bug fix, and I'm skeptical that it'd be an improvement anyway. Probably this is something to revisit whenever somebody gets around to addressing the whole copy-vs-dont-copy-vs-use-a-refcount business that we were handwaving about upthread. >> I also cleaned up the problem the code had with failing to distinguish >> "partcheck list is NIL" from "partcheck list hasn't been computed yet". >> For a relation with no such constraints, generate_partition_qual would do >> the full pushups every time. > Actually, callers must have checked that the table is a partition > (relispartition). That does not mean that it's guaranteed to have any partcheck constraints; there are counterexamples in the regression tests. It looks like the main case is a LIST-partitioned table that has only a default partition. 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