Re: monitoring CREATE INDEX [CONCURRENTLY]

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: monitoring CREATE INDEX [CONCURRENTLY]
Date: 2019-03-11 20:24:09
Message-ID: 20190311202409.GA31627@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Mar-11, Robert Haas wrote:

> On Mon, Mar 11, 2019 at 3:43 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> > > Huh. Well, that's another option, but then what do we do if the
> > > number of phases is not a constant?
> >
> > Well, why do we care? "Some phases might be skipped".
>
> It seems pretty confusing. I mean, in the case of the CLUSTER patch,
> you're either going to seq-scan the table or index-scan the table.
> Those are (at last check) reported using different phase numbers, but
> they are mutually exclusive. Generally, if you are going to do either
> foo -> bar -> baz -> quux or foo -> bletch -> quux, how many phases
> are there total? 5? 4?

Hmm. Your argument is not entirely devoid of merit, but I'm not 100%
convinced either.

So, in CLUSTER, the phases in the middle section are exclusive of one
another. You do bar and baz, or you do bletch. But you never do bar
and bletch, or bletch and baz, or bar on isolation or baz on isolation.
Furthermore, the counting of phases depends on internal system state
(optimizer output), not on the user's input.

In CREATE INDEX, it's not exactly the same. You either have a
complicated 8-phase system (CREATE INDEX CONCURRENTLY) or just a
two-phase system. The phases for the second case are a strict subset of
the cases in the first case. Whether to use one or the other phase
sequence is entirely up to the user.

On the other hand, the subphase numbers vary per AM (but I expect
they're always the same for any one AM.)

To me, it's not a big deal, but if we don't put the number in the phase
name, then we force users to keep the reference documentation open every
time they create an index.

I'm not wed to anything in this area, TBH. My first patch had no phase
numbers and I added them because of reviewer feedback. I do agree we
should be consistent ... but on the other hand, each case is a bit
different: consider VACUUM, which goes back to phase 2 after doing phase
3 for a while. You don't have that behavior for either CLUSTER or
CREATE INDEX.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-03-11 20:25:11 Re: Compressed TOAST Slicing
Previous Message Darafei Praliaskouski 2019-03-11 20:22:18 Re: Compressed TOAST Slicing