Re: DDL Damage Assessment - Mailing list pgsql-hackers

From Claudio Freire
Subject Re: DDL Damage Assessment
Date
Msg-id CAGTBQpbj0AM+0a5e78NWvZij6_wFJ2Pov8wqrj7gxd2_Ot=3Vw@mail.gmail.com
Whole thread Raw
In response to Re: DDL Damage Assessment  (Stephen Frost <sfrost@snowman.net>)
Responses Re: DDL Damage Assessment
List pgsql-hackers
On Thu, Oct 2, 2014 at 4:40 PM, Stephen Frost <sfrost@snowman.net> wrote:
> * Joshua D. Drake (jd@commandprompt.com) wrote:
>> >  2. What do you think such a feature should look like?
>>
>> I liked the other post that said: EXPLAIN <ALTER TABLE> or whatever.
>> Heck it could even be useful to have EXPLAIN ANALZYE <ALTER TABLE>
>> in case people want to run it on staging/test/dev environments to
>> judge impact.
>
> The downside of the 'explain' approach is that the script then has to be
> modified to put 'explain' in front of everything and then you have to go
> through each statement and consider it.  Having a 'dry-run' transaction
> type which then produces a report at the end feels like it'd be both
> easier to assess the overall implications, and less error-prone as you
> don't have to prefex every statement with 'explain'.  It might even be
> possible to have the local "view" of post-alter statements be available
> inside of this 'dry-run' option- that is, if you add a column in the
> transaction then the column exists to the following commands, so it
> doesn't just error out.  Having 'explain <whatever>' wouldn't give you
> that and so you really wouldn't be able to have whole scripts run by
> just pre-pending each command with 'explain'.

That sounds extremely complex. You'd have to implement the fake
columns, foreign keys, indexes, etc on most execution nodes, the
planner, and even system views.

IMO, dry-run per se, is a BEGIN; stuff; ROLLBACK. But that still needs
locks. I don't think you can simulate the side effects without locks,
so getting the local view of changes will be extremely difficult
unless you limit the scope considerably.



pgsql-hackers by date:

Previous
From: Steven Lembark
Date:
Subject: Re: PL/pgSQL 2
Next
From: Peter Geoghegan
Date:
Subject: Re: DDL Damage Assessment