Re: Query JITing with LLVM ORC

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: João Paulo Labegalini de Carvalho <jaopaulolc(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Query JITing with LLVM ORC
Date: 2022-09-21 19:28:19
Message-ID: CA+hUKGKkGkyM2p2r70rvFdy5KCPfAWBgXu1xL_3gwKv4KGV-SQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 22, 2022 at 4:17 AM João Paulo Labegalini de Carvalho
<jaopaulolc(at)gmail(dot)com> wrote:
> I am working on a project with LLVM ORC that led us to PostgreSQL as a target application. We were surprised by learning that PGSQL already uses LLVM ORC to JIT certain queries.

It JITs expressions but not whole queries. Query execution at the
tuple-flow level is still done using a C call stack the same shape as
the query plan, but it *could* be transformed to a different control
flow that could be run more efficiently and perhaps JITed. CCing
Andres who developed all this and had some ideas about that...

> I would love to know what motivated this feature and for what it is being currently used for,

https://www.postgresql.org/docs/current/jit-reason.html

> as it is not enabled by default.

It's enabled by default in v12 and higher (if you built with
--with-llvm, as packagers do), but not always used:

https://www.postgresql.org/docs/current/jit-decision.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-09-21 20:13:58 Re: Reducing the WAL overhead of freezing in VACUUM by deduplicating per-tuple freeze plans
Previous Message Justin Pryzby 2022-09-21 18:22:48 Re: [RFC] building postgres with meson - v13