Re: Manipulating complex types as non-contiguous structures in-memory

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Manipulating complex types as non-contiguous structures in-memory
Date: 2015-05-14 01:19:54
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2015-05-13 21:01:43 -0400, Tom Lane wrote:
>> It is, but why would it be a disaster? We could add StaticAsserts
>> verifying that the sizes actually are different. I doubt that the pad
>> space itself could amount to any issue performance-wise, since it would
>> only ever exist in transient in-memory tuples, and even that only seldom.

> The sizes would be platform dependant.

So what? There are lots of platform-dependent constants in PG.

> It's also just incredibly ugly to
> have to add pad bytes to structures so we can disambiguate them.

Well, I agree it's not too pretty, but you were the one who brought up
the issue of the speed of VARTAG_SIZE(). We definitely gave up some
performance there already, and my patch will make it worse.

> Anyway, I think we can live with your & or my proposed additional branch
> for now. I can't see either variant being a relevant performance
> bottleneck anytime soon.

Actually, after having microbenchmarked the difference between those
two proposals, I'm not too sure that VARTAG_SIZE() is down in the noise.
But it doesn't matter for the moment --- any one of these alternatives
would be a very localized code change, and none of them would create
an on-disk compatibility break. We can let it go until someone wants
to put together a more definitive benchmark for testing.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-05-14 01:39:03 upper planner path-ification
Previous Message Andres Freund 2015-05-14 01:06:09 Re: Manipulating complex types as non-contiguous structures in-memory