Re: [HACKERS] JIT compiling expressions/deform + inlining prototypev2.0 - Mailing list pgsql-hackers

From andres@anarazel.de (Andres Freund)
Subject Re: [HACKERS] JIT compiling expressions/deform + inlining prototypev2.0
Date
Msg-id 20170905164137.qww4277syccjm65y@alap3.anarazel.de
Whole thread Raw
In response to Re: [HACKERS] JIT compiling expressions/deform + inlining prototypev2.0  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
List pgsql-hackers
On 2017-09-05 13:58:56 +0300, Konstantin Knizhnik wrote:
> 
> 
> On 04.09.2017 23:52, Andres Freund wrote:
> > 
> > Yea, I've changed that already, although it's currently added earlier,
> > because the alignment is needed before, to access the column correctly.
> > I've also made number of efficiency improvements, primarily to access
> > columns with an absolute offset if all preceding ones are fixed width
> > not null columns - that is quite noticeable performancewise.
> 
> Unfortunately, in most of real table columns are nullable.

I'm not sure I agree with that assertion, but:


> I wonder if we can perform some optimization in this case (assuming that in
> typical cases column either contains mostly non-null values, either mostly
> null values).

Even if all columns are NULLABLE, the JITed code is still a good chunk
faster (a significant part of that is the slot->tts_{nulls,values}
accesses). Alignment is still cheaper with constants, and often enough
the alignment can be avoided (consider e.g. a table full of nullable
ints - everything is guaranteed to be aligned, or columns after an
individual NOT NULL column is also guaranteed to be aligned). What
largely changes is that the 'offset' from the start of the tuple has to
be tracked.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] A note about debugging TAP failures
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] psql - add special variable to reflect the last query status