I'm using Postgresql 12 (AWS RDS) and pgAdmin4.
While the following statement works
explain select * from table "Commands";
The next one
explain alter table "Commands" drop column "test";
gives this error
LINE 1: explain alter table "Commands" drop column "test";
^
SQL state: 42601
Character: 9
I made sure the statement alter table "Commands" drop column "test"
itself can be run successfully so this cannot be an issue with that statement.
Does explain
not work with alter
or am I missing anything?
alter
statement? What is the underlying problem are you trying to solve by that?explain
statement so I wanted to try it with the alter.Why do you think you need to see the execution plan of an alter statement?
- Guess I need to understand what "Execution plan" is. Thanksexplain
andalter
. Execution plan is mostly about figuring out the best way to finding something (apparent withSELECT
ORUPDATE
on a column with/withoutINDEX
). So it doesn't make sense toexplain
ALTER
becauseALTER
is not concerned with finding something. However, @jjanes pointed out exactly what I was hopingEXPLAIN
would be able to do - to explicitly say if the table will be rewritten.