Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3RT7-0001Nr-Ej for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Mar 2019 20:24:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3RT6-0002Tv-1w for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Mar 2019 20:24:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3RT5-0002Ti-Jd for pgsql-hackers@lists.postgresql.org; Mon, 11 Mar 2019 20:24:15 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3RT2-0000uk-Dg for pgsql-hackers@lists.postgresql.org; Mon, 11 Mar 2019 20:24:14 +0000 Received: by mail-qt1-x841.google.com with SMTP id d16so39905qtn.10 for ; Mon, 11 Mar 2019 13:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=n/5TaRfwi5cZzYD7amdeurtrcW1SKgnvIRUzdmiOpQs=; b=yOplPmeTwaDzvGxDLWjjPf806vHQeYbLAXanVf6L+iuMZ6PAMvo1AH4X3bzKO3B69D V7lQDjAFZhjTeo9LF+TGxWPQu3ztHZTL/2/n/x349+6oWRQU2/E3QPNMWRrPy8YYaiAa gjQWQwQ0xPq+Yy2tdJAbPH9H/4sS96plWvOg+fGnTOE8cX4eNFNd0/ima2e2Tp5QWvlj P8Htwk1Ho/8TAONORmvnroc3Pt7nl7IRelqrFB4Pp47f8PA9I37vMWbHKxA0SHCdJIS5 5Rd77EGK/+sHHMTWrgRt3+EdJ6bdQRLtckI24SYNBDo89ixOV8EUK+SK8uw5Iq4ACEPP ohNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=n/5TaRfwi5cZzYD7amdeurtrcW1SKgnvIRUzdmiOpQs=; b=omZp+eHb5wOf0VoQcjLlcwFG0H/AO0JADqZzD7T7zFDFhpqKdifBuAg51YlysElrhR T8vZ8sCpuy3UHmpOU6SxXt8HURT6ch/qB7JaXO8k1K1UKX9qydzXuYplsDuZl2YgaTdi H55cEiFZVgz5ksu7MKwdJzntg1qn2qLFWiGzdL2p0+dNMuc3eNClNMqDAEz611Zm3L5N FpSNbuxFfDz/fdYh6z9LMaEaEiDJ6sFPl0vfccw/qcZLL6LahHqHIlB1KHnudufuUnSt BwNOdwZE/DWkHD3AVl8y5lAnNJsTjh3RRHG2Q/Jk9XqpGaBDuBh16RRhazJPbofI5Va4 6RPA== X-Gm-Message-State: APjAAAWgf2r9tDTg8x3G9DwQp+oX4h5gmAAA6jLd00BpHo3VyYPPXt/m WRnGwGQXxeThhR+shN6SWqNJ2mcg8oYU3Q== X-Google-Smtp-Source: APXvYqwdUt+AV3mfBYRGLT+2cAFCHBRPfp4tJNKrC36kiJtjwyHnlTftB99tkZuNRdeXaVsVKAD3qw== X-Received: by 2002:ac8:682:: with SMTP id f2mr9879231qth.285.1552335851550; Mon, 11 Mar 2019 13:24:11 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id m185sm4049044qkb.48.2019.03.11.13.24.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2019 13:24:10 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 10340121DF3; Mon, 11 Mar 2019 17:24:09 -0300 (-03) Date: Mon, 11 Mar 2019 17:24:09 -0300 From: Alvaro Herrera To: Robert Haas Cc: Rahila Syed , PostgreSQL Hackers Subject: Re: monitoring CREATE INDEX [CONCURRENTLY] Message-ID: <20190311202409.GA31627@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Mar-11, Robert Haas wrote: > On Mon, Mar 11, 2019 at 3:43 PM Alvaro Herrera 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