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 1jwYG3-000516-J9 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jul 2020 21:51:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jwYG1-000740-ET for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jul 2020 21:51:05 +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 1jwYG1-00073t-2t for pgsql-hackers@lists.postgresql.org; Fri, 17 Jul 2020 21:51:05 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jwYFt-0002sQ-Dc for pgsql-hackers@postgresql.org; Fri, 17 Jul 2020 21:51:04 +0000 Received: by mail-qk1-x742.google.com with SMTP id k18so10150471qke.4 for ; Fri, 17 Jul 2020 14:50:56 -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=PKsRAtfOGt1JECiOfxdKOUz6hgu8kR55rvCV5ed9mIs=; b=acslS09SeDzFRCX4jBGhK2IsBjtzUAOch69+qwz/YIC6cnA3291tHSkxTlW2H9K+wV cvkLjw1beXSZLiefe3KNSG8a78OPUOX+X2tFjhOc2rhHKYwMDiZ8IWy0deD133r/CduK VlWeNKID0Z4eLIBwQAJHN9TMM5LLrOkZWj88SRnOe1qz7OIvnFjJbBGHmHBxURruRftM Zd01IDUE55E4RXeRZPMVa7GMsUb2JV7v0kka70JTcSGVIu/4tTZgHsS9OzOSnBLT76mh yrY0vpETngoOpTf/UFDANUiV2C6qbyK2g0hlyOjFfhsWmd/x9CSoyVPSYZ5vnzegoLZ+ 83cg== 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=PKsRAtfOGt1JECiOfxdKOUz6hgu8kR55rvCV5ed9mIs=; b=uRWz7N+ryj4m7xK2WmEeZN7aqnTlv/Jkofx8b7brkFT9QWtkWkOWSPGpIjCiii5oke RYMO7aIlRc5jPJRl6HhWxiT8q2PBqynF0mIAivcWDKBKwq2c2HUT9ndDHrmLR+4kpTOf k+sSZU0Fx2cLm2wTvrQTOzLuzK6F1Mfc/DLvwQLuw1av5afDPYUPNxxmHB+VZp8c17fu 9eAq+47gznip14a2lKJ/JNCTEJfTgyhET1BqWAZTD1uIlEoVbbcumaxSG12nUoUUzo+z nWAuiVbo/akcZGYENoD6uJOCcJ+pE0EmaghWba1XFh4c6VarfJIITRKSiNkUpKv+cuNe +4FQ== X-Gm-Message-State: AOAM532pKCbZCG4b56yQidKiMA3tSmMOgYkoFiJr44jFcHcKhOdoIIaO owcTTKt17jcGRimYvN4ZEfOdRkKpmCg= X-Google-Smtp-Source: ABdhPJy0WR1VkRqLYtoU0KEPkZjuq3tBOlDZ/uKMHdrIXRfWnBNaAyfrpVDXoraDsruvRrSkOMIvDA== X-Received: by 2002:ac8:5385:: with SMTP id x5mr13099326qtp.230.1595021243964; Fri, 17 Jul 2020 14:27:23 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id k9sm9523214qtu.1.2020.07.17.14.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 14:27:23 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8F79C2A15A8; Fri, 17 Jul 2020 17:27:21 -0400 (-04) Date: Fri, 17 Jul 2020 17:27:21 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: Julien Rouhaud , Michael Paquier , Tomas Vondra , pgsql-hackers Subject: Re: expose parallel leader in CSV and log_line_prefix Message-ID: <20200717212721.GA3827@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200717205421.GR23581@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jul-17, Justin Pryzby wrote: > Ok, but should we then consider changing pg_stat_activity for consistency ? > Probably in v13 to avoid changing it a year later. > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b025f32e0b5d7668daec9bfa957edf3599f4baa8 > > I think the story is that we're exposing to the user a "leader pid" what's > internally called (and used as) the "lock group leader", which for the leader > process is set to its own PID. But I think what we're exposing as leader_pid > will seem like an implementation artifact to users. IMO it *is* an implementation artifact if, as you say, the leader PID remains set after the parallel query is done. I mentioned the pgbouncer case before: if you run a single parallel query, then the process remains a "parallel leader" for days or weeks afterwards even if it hasn't run a parallel query ever since. That doesn't sound great to me. I think it's understandable and OK if there's a small race condition that means you report a process as a leader shortly before or shortly after a parallel query is actually executed. But doing so until backend termination seems confusing as well as useless. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services