175
+
## JIT (Just-In-Time compilation) {#module-services-postgres-jit}
177
+
[JIT](https://www.postgresql.org/docs/current/jit-reason.html)-support in the PostgreSQL package
178
+
is disabled by default because of the ~300MiB closure-size increase from the LLVM dependency. It
179
+
can be optionally enabled in PostgreSQL with the following config option:
183
+
services.postgresql.enableJIT = true;
187
+
This makes sure that the [`jit`](https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT)-setting
188
+
is set to `on` and a PostgreSQL package with JIT enabled is used. Further tweaking of the JIT compiler, e.g. setting a different
189
+
query cost threshold via [`jit_above_cost`](https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT-ABOVE-COST)
190
+
can be done manually via [`services.postgresql.settings`](#opt-services.postgresql.settings).
192
+
The attribute-names of JIT-enabled PostgreSQL packages are suffixed with `_jit`, i.e. for each `pkgs.postgresql`
193
+
(and `pkgs.postgresql_<major>`) in `nixpkgs` there's also a `pkgs.postgresql_jit` (and `pkgs.postgresql_<major>_jit`).
194
+
Alternatively, a JIT-enabled variant can be derived from a given `postgresql` package via `postgresql.withJIT`.
195
+
This is also useful if it's not clear which attribute from `nixpkgs` was originally used (e.g. when working with
196
+
[`config.services.postgresql.package`](#opt-services.postgresql.package) or if the package was modified via an
197
+
overlay) since all modifications are propagated to `withJIT`. I.e.
203
+
postgresql = super.postgresql.overrideAttrs (_: { pname = "foobar"; });