Alex R
Alex R

Reputation: 11881

Get the QUERY PLAN without executing the query?

I'm trying to optimize a long-running query in PostgreSQL 11.

Every time I tweak the query or create some new indexes and then do an EXPLAIN ANALYZE SELECT ... to see if it worked, I have to wait a long time for the explanation.

Is there a way to get the QUERY PLAN without actually executing the query, dare I say it, just like the way it works in MySQL?

Upvotes: 9

Views: 5450

Answers (1)

user330315
user330315

Reputation:

As documented in the manual just run it without analyze

The ANALYZE option causes the statement to be actually executed, not only planned

explain
select ...
from ...
where ...

or

explain
update ...

Upvotes: 14

Related Questions