0

I have a Django app with a PostgreSQL database. Everything was running smoothly until I moved the stack to Docker. Now, one of my big queries is running really slowly, and I noticed that the PostgreSQL container is eating up all the CPU for that particular query.

Here is the query on my local machine: https://pastebin.com/vUxAs5iU

And here is the query on the Docker container: https://pastebin.com/5TGba8Me

I noticed that I don't have the JIT analyzes on my local machine, and I'm not sure what the values in the Docker container mean or how to fix them. I've already tried increasing the CPU for the container, but it didn't help. What steps can I take to optimize my psql or query?

Any help would be greatly appreciated. If you need more information about the problem, please let me know.

7
  • 1
    to disable jit via sql you can use alter system set jit to off; select pg_reload_conf();
    – Sahap Asci
    May 18, 2023 at 16:28
  • @SahapAsci oh thats fine, the problem is performance of my query, that you can see on the second link. im don't know why is it taking too long to execute
    – scaryhamid
    May 18, 2023 at 16:30
  • Because JIT is taking all of the time. (That is why you should disable it.)
    – jjanes
    May 18, 2023 at 17:22
  • @jjanes Owwh, Thank you very much, worked.
    – scaryhamid
    May 19, 2023 at 11:48
  • @jjanes btw, i read that jit is useful for queries with a lot of joins and aggregations and complex queries, why is it bad in my case?
    – scaryhamid
    May 19, 2023 at 12:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.