Search code examples
linuxpostgresql.net-corepostgresql-12

PostgreSQL query is taking too long to execute on LINUX server


I have recently deployed PostgreSQL database to Linux server and one of the stored procedure is taking around 24 to 26 second to fetch the result. Previously i was deployed PostgreSQL database to windows server and the same stored procedure is taking around only 1 to 1.5 second.

In both cases i have tested with same database with same amount of data. and also both server have same configuration like RAM, Processor,.. etc.

While executing my stored procedure in Linux server CPU usages goes to 100%.

Execution Plan for Windows:

**enter image description here**

Execution Plan for Linux:

enter image description here

Let me know if you have any solution for the same.


Solution

  • It also might be because of JIT coming into play in the Linux server and not on windows. Check if the query execution plan on the linux server includes information about JIT. If yes, check if that's the same in windows version. If not, than I suspect that is the case.

    JIT might be adding more overhead, hence try changing the jit parameters like jit_above_cost, jit_inline_above_cost to appropriate values as per your system requirements or disable those completely by setting

    jit=off
    

    or

    jit_above_cost = -1