Search code examples
postgresqlquery-performancesql-execution-planpostgresql-12

Different execution plan in windows and Linux for PostgreSQL


I have recently deployed PostgreSQL database on Linux server. One of the stored procedure is taking around 3 to 4 seconds to fetch the result. Previously i was deployed PostgreSQL database to windows server and the same stored procedure fetching result within second. I have checked execution plan in both the cases.
It is almost same but Linux execution plan contains below extra detail.

    JIT:
  Functions: 171
  Options: Inlining true, Optimization true, Expressions true, Deforming true
  Timing: Generation 26.548 ms, Inlining 8.198 ms, Optimization 2052.958 ms, Emission 1241.730 ms, Total 3329.434 ms

Let me know if you have any idea for above detail and have any root cause of slowness issue.


Solution

  • It looks like JIT is doing you more harm than good on Linux, so turn it off, by for example putting jit=off in postgresql.conf file.

    Your Windows version probably didn't come with JIT in the first place. The EnterpriseDB installer for Windows didn't include it, anyway. So even though the parameter jit shows as on, it doesn't do anything as there is nothing there to turn on.