Re: Manipulating complex types as non-contiguous structures in-memory
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Pavel Stehule <pavel.stehule@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2015-05-14T00:48:51Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > On 2015-05-10 12:09:41 -0400, Tom Lane wrote: >> Andres Freund <andres@anarazel.de> writes: >>> * The VARTAG_IS_EXPANDED(tag) trick in VARTAG_SIZE is unlikely to >>> beneficial, before the compiler could implement the whole thing as a >>> computed goto or lookup table, afterwards not. >> Well, if you're worried about the speed of VARTAG_SIZE() then the right >> thing to do would be to revert your change that made enum vartag_external >> distinct from the size of the struct, so that we could go back to just >> using the second byte of a varattrib_1b_e datum as its size. As I said >> at the time, inserting pad bytes to force each different type of toast >> pointer to be a different size would probably be a better tradeoff than >> what commit 3682025015 did. > I doubt that'd be a net positive. Anyway, all I'm saying is that I can't > see the VARTAG_IS_EXPANDED trick being beneficial in comparison to > checking both explicit values. I did some microbenchmarking on this, and AFAICT doing it your way makes it slower. I still think that going back to defining the second byte as the size would be better. Fortunately, since this is only a matter of in-memory representations, we aren't committed to any particular answer. regards, tom lane
Commits
-
Use fast path in plpgsql's RETURN/RETURN NEXT in more cases.
- 9e3ad1aac524 9.5.0 cited
-
Add support for multiple kinds of external toast datums.
- 368202501539 9.4.0 cited