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 1h0q4r-0000eu-A2 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2019 16:04:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h0q4n-0004Ye-2M for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2019 16:04:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h0mjK-0002Eq-Bt for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2019 12:30:02 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h0mjD-00041x-HF for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2019 12:30:01 +0000 Received: by mail-pf1-x442.google.com with SMTP id n125so2933714pfn.5 for ; Mon, 04 Mar 2019 04:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=lopiJK+3oW2vijJC9Wx1LQJEoo+pGNun9VGwPPK+H0k=; b=FiMuvmflhExV2mUUklA9SlOaH2kRGo6Q2o1fKeXeluNce5gci6fT8A5DkITsrgka0H /HxKXKFg/QW8rTs5z3gDek5BDwWHtdZ+fZQtOC8WAvd+Rq1I154vwLt6rhjQblTcg0fZ zDUEQK2eL0jGObg1KZpabZel+GmXQNXDeOADsu49iK+DAyJV/zylNt0NwEt1/tGp5nhg SWk0Gu/D/mP/qFjQoRODie38rWhW5wfKTqnV2G49DNUzOrA52QruRcsCjplpeMLnieMM IQB9wmYmQubcyE8OGoP6zCguozpRXkzNvsz0U/va/XledGDmK8qad6M6aHjd4h4ocubZ IaCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=lopiJK+3oW2vijJC9Wx1LQJEoo+pGNun9VGwPPK+H0k=; b=dCWwyXM8nLLDOLNXsz2TqKSeMm4MiX6Tb/GbqdcMbLsGlD2eb6ABmoEQRgDeXHrkB3 IMrK5EN5qrm9MwvSRRowmtbwFwdjfYe97guSyY6PR63P/n3dO/vaBWLm0m64qWzNwTu9 AmmwZfvMcASR/0HKbMUlR2lJ9sfGHitImYvaUxAj4qwiBGpWvMeT5uMLEA8IV/enINOs Taaa4faCDBGglhlB52rVCq0XcYWmsztvSo2OzyOqEwQCTjlnEiUOQnkufQPjJE81p1YJ 6QUR3mzJOabZTfnYSJI8uenoI2svdeiMOh1qHP24pXX1OiFmNEtyDsQhfwb/utwCHoeN M+Zg== X-Gm-Message-State: AHQUAubqz0OYHL1W1Z9Ej2zw/gjJAEdPNskcOrmCays6btON+6lOWH9f XtetNlzPaCeOvZGOa6T2SIA+iA== X-Google-Smtp-Source: APXvYqy+SAuxs1PlLcTwpIONUb6YnlYVLxlgOm8VQ0WOSXxs5g7Hn/7BcRtUP8yVJrqER6lxLUYbrw== X-Received: by 2002:a62:834c:: with SMTP id h73mr20569232pfe.252.1551702591907; Mon, 04 Mar 2019 04:29:51 -0800 (PST) Received: from Fuzails-MacBook-Pro.local ([122.162.45.73]) by smtp.gmail.com with ESMTPSA id t10sm11866717pfa.151.2019.03.04.04.29.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 04:29:51 -0800 (PST) Subject: Re: monitoring CREATE INDEX [CONCURRENTLY] To: pgsql-hackers@lists.postgresql.org, Alvaro Herrera References: <20190222215423.GA16912@alvherre.pgsql> From: Rahila Message-ID: <17b0f8fd-b51b-ee83-0ec8-9e363ba1d9c6@2ndquadrant.com> Date: Mon, 4 Mar 2019 17:59:48 +0530 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.2 MIME-Version: 1.0 In-Reply-To: <20190222215423.GA16912@alvherre.pgsql> Content-Type: multipart/alternative; boundary="------------8EECDA29313618460DACE991" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------8EECDA29313618460DACE991 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Hi Alvaro, Resending the email as earlier one didn't get sent on pgsql-hackers. On 2/23/19 3:24 AM, Alvaro Herrera wrote: > On 2019-Feb-13, Amit Langote wrote: > >> Doesn't the name amphasename sound a bit too generic, given that it can >> only describe the phases of ambuild? Maybe ambuildphase? > Hmm, yeah, maybe it does. I renamed it "ambuildphasename", since it's > not about reporting the phase itself -- it's about translating the phase > number to the string that's reported to the user. > > The attached patch does it that way. Also, when an index build uses an > AM that doesn't support progress reporting, it no longer reports a NULL > phase name while building. I also changed it to report the progress of > phase 7 (heap scan validation) using block numbers rather than tuple > counts. I also tweaked the strings reported in the view. They're > clearer now IMO. > > One slight annoyance is that when parallel workers are used, the last > block number reported in phase 3/subphase 2 (IndexBuildHeapScan stuff) > is not necessarily accurate, since the tail of the table could well be > scanned by a worker that's not the leader, and we only report in the > leader when it gets a new block. > > When the AM does not support progress reporting, everything stays as > zeros during the index build phase. It's easy to notice how slow hash > indexes are to build compared to btrees this way! Maybe it'd be > better fallback on reporting block numbers in IndexBuildHeapScan when > this happens. Thoughts? > > I added docs to the monitoring section -- that's the bulkiest part of > the patch. 1. Thank you for incorporating review comments. Can you please rebase the latest 0001-Report-progress-of- CREATE-INDEX-operations.patch on master? Currently it does not apply on 754b90f657bd54b482524b73726dae4a9165031c > 15:56:44.694 | building index (3 of 8): initializing (1/5) | 442478 | 442399 | 0 | 0 | 0 | 0 > 15:56:44.705 | building index (3 of 8): sorting tuples, spool 1 (3/5) | 442478 | 442399 | 100000000 | 0 | 0 | 0 > 15:56:44.716 | building index (3 of 8): sorting tuples, spool 1 (3/5) | 442478 | 442399 | 100000000 | 0 | 0 | 0 > 15:56:44.727 | building index (3 of 8): final btree sort & load (5/5) | 442478 | 442399 | 100000000 | 79057 | 0 | 0 > 15:56:44.738 | building index (3 of 8): final btree sort & load (5/5) | 442478 | 442399 | 100000000 | 217018 | 0 | 0 > 15:56:44.75 | building index (3 of 8): final btree sort & load (5/5) | 442478 | 442399 | 100000000 | 353804 | 0 | 0 > 2. In the above report, even though we are reporting progress in terms of tuples_done for final btree sort & load phase we have not cleared the blocks_done entry from previous phases. I think this can be confusing as the blocks_done does not correspond to the tuples_done in the final btree sort & load phase. Thank you, Rahila Syed --------------8EECDA29313618460DACE991 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

Hi Alvaro,

Resending the email as earlier one didn't get sent on pgsql-hackers.

On 2/23/19 3:24 AM, Alvaro Herrera wrote:
On 2019-Feb-13, Amit Langote wrote:

Doesn't the name amphasename sound a bit too generic, given that it can
only describe the phases of ambuild?  Maybe ambuildphase?
Hmm, yeah, maybe it does.  I renamed it "ambuildphasename", since it's
not about reporting the phase itself -- it's about translating the phase
number to the string that's reported to the user.

The attached patch does it that way.  Also, when an index build uses an
AM that doesn't support progress reporting, it no longer reports a NULL
phase name while building.  I also changed it to report the progress of
phase 7 (heap scan validation) using block numbers rather than tuple
counts.  I also tweaked the strings reported in the view.  They're
clearer now IMO.

One slight annoyance is that when parallel workers are used, the last
block number reported in phase 3/subphase 2 (IndexBuildHeapScan stuff)
is not necessarily accurate, since the tail of the table could well be
scanned by a worker that's not the leader, and we only report in the
leader when it gets a new block.

When the AM does not support progress reporting, everything stays as
zeros during the index build phase.  It's easy to notice how slow hash
indexes are to build compared to btrees this way!  Maybe it'd be
better fallback on reporting block numbers in IndexBuildHeapScan when
this happens.  Thoughts?

I added docs to the monitoring section -- that's the bulkiest part of
the patch.

1. Thank you for incorporating review comments.
Can you please rebase the latest 0001-Report-progress-of-
CREATE-INDEX-operations.patch on master? Currently it does not apply on 754b90f657bd54b482524b73726dae4a9165031c
 15:56:44.694 | building index (3 of 8): initializing (1/5)            |       442478 |      442399 |            0 |           0 |                0 |               0
 15:56:44.705 | building index (3 of 8): sorting tuples, spool 1 (3/5) |       442478 |      442399 |    100000000 |           0 |                0 |               0
 15:56:44.716 | building index (3 of 8): sorting tuples, spool 1 (3/5) |       442478 |      442399 |    100000000 |           0 |                0 |               0
 15:56:44.727 | building index (3 of 8): final btree sort & load (5/5) |       442478 |      442399 |    100000000 |       79057 |                0 |               0
 15:56:44.738 | building index (3 of 8): final btree sort & load (5/5) |       442478 |      442399 |    100000000 |      217018 |                0 |               0
 15:56:44.75  | building index (3 of 8): final btree sort & load (5/5) |       442478 |      442399 |    100000000 |      353804 |                0 |               0
 
2. In the above report, even though we are reporting progress in terms of tuples_done for final btree sort & load phase we have not cleared
the blocks_done entry from previous phases. I think this can be confusing as the blocks_done does not correspond to the tuples_done in the final btree sort & load phase.

Thank you,
Rahila Syed


 
--------------8EECDA29313618460DACE991--