File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
contentcuration/contentcuration Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1+ from django .db .backends .postgresql .features import DatabaseFeatures
12from django .db .backends .signals import connection_created
23from django .dispatch import receiver
34
45
56@receiver (connection_created )
67def set_jit (sender , connection , ** kwargs ):
78 """
8- Disable Just-In-Time compilation for PostgreSQL databases, at least until we can
9+ Disable Just-In-Time compilation for PostgreSQL databases >= 11 , at least until we can
910 optimize its use.
1011 https://www.postgresql.org/docs/12/runtime-config-query.html#GUC-JIT
1112 """
1213 if connection .vendor == 'postgresql' :
13- with connection .cursor () as cursor :
14- cursor .execute ("SET jit = 'off';" )
14+ db_features = DatabaseFeatures (connection )
15+ # JIT is new in v11, and for reference this returns True for v11 and following
16+ if db_features .is_postgresql_11 :
17+ with connection .cursor () as cursor :
18+ cursor .execute ("SET jit = 'off';" )
You can’t perform that action at this time.
0 commit comments