Postgres EXPLAIN ANALYZE Performance Issues

explainperformancepostgresql

there is Postgres 9.6 on Redhat
I want to EXPLAIN ANALYZE slow query (quite complex one) and it takes too much time. My session with EXPLAIN ANALYZE consume 100% of one CPU and doesn't finish even after 24 hours.
How to analyze the issue if Postgres can't build an execution plan?

Best Answer

If you only want to look at the execution plan, run EXPLAIN without ANALYZE.

ANALYZE will cause the query to be executed, which provides much more useful data, but takes as long as the query runs.