On Thu, Sep 22, 2022 at 4:17 AM João Paulo Labegalini de Carvalho
<jaopaulolc@gmail.com> wrote:
> I am working on a project with LLVM ORC that led us to PostgreSQL as a target application. We were surprised by
learningthat 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