Re: Improving executor performance - Mailing list pgsql-hackers

From Andreas Seltenreich
Subject Re: Improving executor performance
Date
Msg-id 87r3aw0w6p.fsf@credativ.de
Whole thread Raw
In response to Re: Improving executor performance  (Andres Freund <andres@anarazel.de>)
Responses Re: Improving executor performance
List pgsql-hackers
Andres Freund writes:

> The problem is that the previous form has a lot of ad-hoc analysis
> strewn in. The interesting part is getting rid of all that. That's what
> the new ExecInitExpr2() does. The target form can be both evaluated more
> efficiently in the dispatch manner in the patch, and quite simply
> converted to a JIT - without duplicating the analysis code.  I did write
> a small ad-hoc x86 jit, and it was really quite straightforward this
> way.

Ja, I see the advantage when doing ad-hoc-JIT compilation.

> What did you do with JIT and expression evaluation? You basically just
> replaced the toplevel ExprState note with a different evalfunc, pointing
> into your code?

That's the plan, yes.  I'm sorry there's no publishable code yet on the
the postgres side of things.  Using libFirm[1], the plan is to.

1. Automatically generate Firm-IR for the static C code around  expression evaluation as well operators in the system
catalog.

2. Construct IR for expression trees (essentially all the function calls  the executor would do).

3. Push libFirm's optimize button.  At this stage, most of the  dispatching goes away by inlining the calls including
functionsfrom  the catalog implementing operators.
 

4. Generate code and replace the toplevel expression node with a funcall  node.

I did implement this recipe with a toy Forth interpreter to see whether
libFirm was up to the job (Nobody's done JIT with libFirm before).  The
results were favorable[2].  Currently, a student at credativ is working
on applying these techniques to postgres.

regards,
Andreas

Footnotes: 
[1]  http://libfirm.org/

[2]  https://korte.credativ.com/~ase/firm-postgres-jit-forth.pdf




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PERFORM] 9.4 -> 9.5 regression with queries through pgbouncer on RHEL 6
Next
From: Andres Freund
Date:
Subject: Re: Improving executor performance