Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the QUERY PLAN without executing the query?

Tags:

postgresql

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?

like image 704
Alex R Avatar asked Mar 26 '26 05:03

Alex R


1 Answers

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 ...

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!