Re: Thinking about EXPLAIN ALTER TABLE - Mailing list pgsql-hackers

From John Naylor
Subject Re: Thinking about EXPLAIN ALTER TABLE
Date
Msg-id CAJVSVGU2J+WaafmCB=VvjrU_+sMhk+cVhjRjXN=Xe-H9FOPrBA@mail.gmail.com
Whole thread Raw
In response to Thinking about EXPLAIN ALTER TABLE  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On 12/7/18, Greg Stark <stark@mit.edu> wrote:
> I've been poking around with a feature I've wanted a number of times
> in the past, "EXPLAIN ALTER TABLE".

I believe I've seen your messages to that effect in the archives, so
I've had it in the back of my mind as well. I think it could be very
useful.

> 3. Whether a full table constraint validation is going to happen

Is it possible that this can occur via index-only scan and that this
feature could know that?

> For the most part ALTER TABLE is already structured such that this is
> pretty easy. It does a lot of preparatory work without doing catalog
> updates and I can just call that same preparatory work without calling
> the subsequent work phases.

One thing that came to mind: Since the input is not a plan tree, it
seems it would be more difficult to keep EXPLAIN in sync with
additional ALTER TABLE features. Do you have any thoughts about that?

> postgres***=# explain alter table t alter column i set not null;
> ┌─────────────────────────────────┐
> │           QUERY PLAN            │
> ├─────────────────────────────────┤
> │ Lock Level: AccessExclusiveLock │
> │ ALTER TABLE: t                  │
> │   Relation: t                   │
> │   Rewrite: none                 │
> │   Relation: t2                  │
> │   Rewrite: none                 │
> └─────────────────────────────────┘

In this example, I assume the two relations are partitions? With many
partitions, this could get unwieldy pretty fast. I imagine there could
be a shorthand notation.

-John Naylor

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_partition_tree crashes for a non-defined relation
Next
From: Stephen Frost
Date:
Subject: Dead code in toast_fetch_datum_slice?