[db] Disable JIT for postgres (#12893)

* disable postgres JIT by default

* Update docs
This commit is contained in:
Oliver
2026-09-20 19:09:55 +10:00
committed by GitHub
parent 6176135821
commit 10422dc37b
2 changed files with 17 additions and 0 deletions
+4
View File
@@ -280,6 +280,10 @@ If running with a PostgreSQL database backend, the following additional options
| `INVENTREE_DB_TCP_KEEPALIVES_COUNT` | database.tcp_keepalives_count | 5 | TCP keepalive count | | `INVENTREE_DB_TCP_KEEPALIVES_COUNT` | database.tcp_keepalives_count | 5 | TCP keepalive count |
| `INVENTREE_DB_TCP_USER_TIMEOUT` | database.tcp_user_timeout | 2000 | TCP user timeout (ms) | | `INVENTREE_DB_TCP_USER_TIMEOUT` | database.tcp_user_timeout | 2000 | TCP user timeout (ms) |
| `INVENTREE_DB_ISOLATION_SERIALIZABLE` | database.serializable | False | Database isolation level configured to "serializable" | | `INVENTREE_DB_ISOLATION_SERIALIZABLE` | database.serializable | False | Database isolation level configured to "serializable" |
| `INVENTREE_DB_JIT_ENABLED` | database.jit_enabled | False | Enable JIT compilation for PostgreSQL queries |
!!! info "JIT Compilation"
PostgreSQL supports [JIT compilation](https://www.postgresql.org/docs/current/jit.html) for queries. This is disabled by default, as it can cause performance issues for small queries.
### MySQL Settings ### MySQL Settings
@@ -208,6 +208,19 @@ def set_postgres_options(db_options: dict):
'inventree-worker' if isInWorkerThread() else 'inventree-server' 'inventree-worker' if isInWorkerThread() else 'inventree-server'
) )
extra_options = []
if 'options' in db_options:
extra_options.append(db_options['options'])
if not get_boolean_setting(
'INVENTREE_DB_JIT_ENABLED', 'database.jit_enabled', False
):
extra_options.append('-c jit=off')
if extra_options:
db_options['options'] = ' '.join(extra_options)
def set_mysql_options(db_options: dict): def set_mysql_options(db_options: dict):
"""Set database options specific to mysql backend.""" """Set database options specific to mysql backend."""