Re: JIT compiling expressions/deform + inlining prototype v2.0

From: andres(at)anarazel(dot)de (Andres Freund)
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: JIT compiling expressions/deform + inlining prototype v2.0
Date: 2017-09-05 16:41:37
Message-ID: 20170905164137.qww4277syccjm65y@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-09-05 16:54:14 Re: psql - add special variable to reflect the last query status
Previous Message Peter Eisentraut 2017-09-05 16:37:33 Re: A note about debugging TAP failures