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.
alter system set jit to off; select pg_reload_conf();