Re: TupleTableSlot abstraction
Andres Freund <andres@anarazel.de>
Hi, On 2018-08-31 10:05:05 +0530, Amit Khandekar wrote: > On 28 August 2018 at 22:43, Ashutosh Bapat > >> I think I was wrong at saying that we should remove this. I think you > >> were right that it should become a callback... > > > We have replaced all slot_getsysattrs() with heap_getsysattr(). Do you > > want to reinstantiate those as well? If so, slot_getsysattr() becomes > > a wrapper around getsysattr() callback. Right. > One option is that the getsysattr() callback function returns false if > system attributes are not supported for that slot type. Other option > is that in the not-supported case, the function errors out, meaning > that the caller should be aware that the slot type is the one that > supports system attributes. > I had prepared changes for the first option, but Ashutosh Bapat > offlist made me realize that it's worth considering the 2nd option( > i.e. erroring out). I think we should error out. > >> I still think this is an optimization with a negative benefit, > >> especially as it requires an extra callback. We should just rely on > >> slot_deform_tuple and then access that. That'll also just access the > >> null bitmap for the relevant column, and it'll make successive accesses > >> cheaper. > > > > I don't understand why we have differing implementations for > > slot_attisnull(), slot_getsomeattrs(), slot_getattr() in HEAD. If what > > you are saying is true, we should have implemented all the first and > > last as a call to slot_getsomeattrs() followed by returing values from > > tts_values and tts_isnull. Since this is refactoring work, I am trying > > not to change the existing functionality of those functions. > > I agree that we should not change the way in which slot_getattr() > finds the attr; i.e. first call att_isnull(), and only then try to > deform the tuple. I mean there must be some good reason that is done > on HEAD. Maybe we can change this separately after investigation, but > not as part of the tuple abstraction patch. There's really no good reason for the behaviour as it exists on HEAD. It already can cause worse performance there. The price to pay for continuing to have an optimization which isn't actually optimizing anything is way too high if it requires us to have multiple functionally unnecessary callbacks. Greetings, Andres Freund
Commits
-
Fix memory leak when inserting tuple at relation creation for CTAS
- 414a9d3cf34c 12.0 landed
-
Build HashState's hashkeys expression with the correct parent.
- 5f32b29c1819 12.0 landed
-
Move TupleTableSlots boolean member into one flag variable.
- c5257345ef61 12.0 landed
-
Move generic slot support functions from heaptuple.c into execTuples.c.
- 9d906f1119de 12.0 landed
-
Remove absolete function TupleDescGetSlot().
- 10763358c3f0 12.0 landed
-
Remove function list from prologue of execTuples.c.
- bbdfbb9154fc 12.0 landed
-
Split ExecStoreTuple into ExecStoreHeapTuple and ExecStoreBufferHeapTuple.
- 29c94e03c7d0 12.0 landed
-
Change TupleTableSlot->tts_nvalid to type AttrNumber.
- a598708ffa8e 12.0 landed
-
Deduplicate code between slot_getallattrs() and slot_getsomeattrs().
- 88ebd62fcc2e 12.0 landed
-
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs
- ee8012481190 12.0 cited
-
Spell "partitionwise" consistently.
- 31380bc7c204 12.0 cited
-
Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.
- 8f5ac440430a 11.0 cited