Don't codegen deform code for virtual tuples in expr eval for scan fetch - Mailing list pgsql-hackers

From Soumyadeep Chakraborty
Subject Don't codegen deform code for virtual tuples in expr eval for scan fetch
Date
Msg-id CAE-ML+_66cVe1N_VBRXHwhqdPx+nJ2g=5fOpVZX_uO_M5Xb0GA@mail.gmail.com
Whole thread Raw
Responses Re: Don't codegen deform code for virtual tuples in expr eval forscan fetch
Re: Don't codegen deform code for virtual tuples in expr eval forscan fetch
List pgsql-hackers
Hello Hackers,

This is to address a TODO I found in the JIT expression evaluation
code (opcode =
EEOP_INNER_FETCHSOME/EEOP_OUTER_FETCHSOME/EEOP_SCAN_FETCHSOME):

* TODO: skip nvalid check if slot is fixed and known to
* be a virtual slot.

Not only should we skip the nvalid check if the tuple is virtual, the
whole basic block should be a no-op. There is no deforming to be done,
JIT (slot_compile_deform) or otherwise (slot_getsomeattrs) for virtual
tuples.

Attached is a patch 0001 that achieves exactly that by:

1. Performing the check at the very beginning of the case.
2. Emitting an unconditional branch to the next opblock if we have a
virtual tuple. We end up with a block with just the single
unconditional branch instruction in this case. This block is optimized
away when we run llvm_optimize_module().

Also enclosed is another patch 0002 that adds on some minor
refactoring of conditionals around whether to JIT deform or not.

---
Soumyadeep Chakraborty
Attachment

pgsql-hackers by date:

Previous
From: Amit Khandekar
Date:
Subject: Re: logical decoding : exceeded maxAllocatedDescs for .spill files
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Efficient output for integer types