The query has a recursive join that uses a table with only 80k records and that table is not updated often.
2. The I/O load was not high. CPU utilization was very high and load was very high.
We have a large effective_cache_size = 512GB (25% of total memory)
so your server has 2TB RAM? It is not usual server - so this issue can be pretty strange :(
What is size of shared memory? Probably is significantly lower than effective_cache_size? Try to reduce effective cache size to be lower than shared buffers