Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWhOQ-0001me-12 for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Oct 2020 14:53:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kWhON-0001x6-Es for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Oct 2020 14:53:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWhON-0001wz-81 for pgsql-hackers@lists.postgresql.org; Sun, 25 Oct 2020 14:53:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWhOJ-0006WO-Qv for pgsql-hackers@postgresql.org; Sun, 25 Oct 2020 14:53:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09PEqowQ439666; Sun, 25 Oct 2020 10:52:50 -0400 From: Tom Lane To: Noah Misch cc: Peter Geoghegan , Andres Freund , Phil Florent , PostgreSQL Hackers Subject: Re: pgstat_report_activity() and parallel CREATE INDEX (was: Parallel index creation & pg_stat_activity) In-reply-to: <20201025051836.GC2651494@rfd.leadboat.com> References: <20201014022636.GA1962668@rfd.leadboat.com> <20201025051836.GC2651494@rfd.leadboat.com> Comments: In-reply-to Noah Misch message dated "Sat, 24 Oct 2020 22:18:36 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <439664.1603637570.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 25 Oct 2020 10:52:50 -0400 Message-ID: <439665.1603637570@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Noah Misch writes: > On Sat, Oct 17, 2020 at 08:39:35AM -0700, Peter Geoghegan wrote: >> I also prefer 2. > Thanks. Here is the pair of patches I plan to use. The second is equiv= alent > to v0; I just added a log message. The change in worker_spi_main seems a little weird/lazy. I'd be inclined to set and clear debug_query_string each time through the loop, so that those operations are adjacent to the other status-reporting operations, as they are in initialize_worker_spi. I don't really like modifying a StringInfo while debug_query_string is pointing at it, either. Yeah, you'll *probably* get away with that because the buffer is unlikely to move, but since the whole exercise can only benefit crash-debugging scenarios, it'd be better to be more paranoid. One idea is to set debug_query_string immediately before each SPI_execute and clear it just afterwards, rather than trying to associate it with pgstat_report_activity calls. regards, tom lane