Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzamz-003zdz-7o for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 12:32:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tzamx-001nkN-R8 for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 12:32:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzamx-001nkC-G6 for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 12:32:19 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzamv-002L7d-1m for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 12:32:18 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-abec8b750ebso861053166b.0 for ; Tue, 01 Apr 2025 05:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743510736; x=1744115536; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZavT9jM6uSMeTVlc0G97dqBJw1v5jcVywdcBOUHYZ9c=; b=UK9wpi8UwbHCmae55c2cGzKKNe8dI2XBendFfEF5sTKqTeUtxc+bBhSY2fgz4tTrGv 5vP+zMX6Oxm2/5Sh+GUWvrcGVDDIsjsSJo075BwMHpJ/89wm4+2DngfI7uFHWWxVAmfB jaW4cnCowhy5ZhtDut1mcuJ4A0vGomtUBPr4iVmqZiNJIvdFm1EmJroLojAEA/EwCKF3 tx9hR9XGO80OMdQwa8w02EqbGuOys/kBfHaG6RgkMAcWlUmUxdJ0Fx3Sr6XT1OjbYu4b kHIbvhAUrwxbwKxCWAmLU4b2lkybBauPtImWaf08fL7LU6XFQx23T1qHD0vAYtO+3vrk nA/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743510736; x=1744115536; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZavT9jM6uSMeTVlc0G97dqBJw1v5jcVywdcBOUHYZ9c=; b=JUASXfM2h3TK+w6LFOKGi0+DpDYRh1h7oAOQLj41bYo0ICl9/FLCkuYqgGf7LO2k74 JGnfMX6dMw2KnzKw+MOmJP6NNmts8DiqP4ZOuyum/AMJpTpgbS3cV0BDx0mN7WYuab+x 1MeGPichfs04O6LzBzCVXkQTeETDIafpkVM/rKojHb8vo/3eSWkKN7HNhBbh4UNtAgUZ W7Lcxc0y5dJiSaqgukK/r9r6ocd6yQEUMZN197PD1StVc1JuPsfAzlWt6kxO55QKBaD6 qogCGQGQWH6sS9D0ESFPbYXjTqDZ4diNYqAmbkWnMZYhpnbNW3OurW5+9S60WWUckgTP O4Dg== X-Forwarded-Encrypted: i=1; AJvYcCWzCVuHhVx/RzSXk5x6Fl+OUqkicxSYUv1oQWPrbFSTwQRKf/hwPVNZhYmDEQ5utpucdfTvH+mMGibhWmSG@lists.postgresql.org X-Gm-Message-State: AOJu0Yx6qvDzu07E7aQrzY9MhJzOyj7nEroUdjga0L3OgO3u+7YLjEI3 bkpcjdxTj1XHlCuhHlkU9043Hy2sG09682ZGm1TqSPXJQ5W9gAwxKUPRUV1f9Jt8xijGJzUgTrQ 2wJR/36FLrjzRgkUtU4oXPIMLb5ETP9Ryh40= X-Gm-Gg: ASbGncs5w1DH+GUWOk/cpY96lR165v9fLZCX9V9AlFgIgW8Gi3jhEN439rI1WKJKOPo z15kybkT4XqzF22tyGODQ9L4zMfwWCTcLSxFMPkVzLVz0csCk0m8+86oKdnfzoUC29YaP3f06oA 6tcpoTImePCmKZnl61qm4q34puiH9oaWsktV2r X-Google-Smtp-Source: AGHT+IFFpwnmPgoyUQwHVuy5ifBbKbkNLjkhPyJDhClrz78NlxU1j16NIpnC4Hdkwg1PwhbPoKJE9iUkWLWAch4PDJo= X-Received: by 2002:a17:906:7955:b0:ac4:2ad:44d9 with SMTP id a640c23a62f3a-ac738a5083emr1261046866b.24.1743510735614; Tue, 01 Apr 2025 05:32:15 -0700 (PDT) MIME-Version: 1.0 References: <2aedcb5e8120bfdee994775e660f8718@oss.nttdata.com> <174144854199.294105.9417032645816235284.pgcf@coridan.postgresql.org> <784224198089cbe3cc3825332f195475@oss.nttdata.com> <067675dd73b5485ecf0159d9a986846d@oss.nttdata.com> In-Reply-To: <067675dd73b5485ecf0159d9a986846d@oss.nttdata.com> From: Robert Haas Date: Tue, 1 Apr 2025 08:32:04 -0400 X-Gm-Features: AQ5f1JrOFgJpP7GKzr0mg_KLJlhFrRZlj9YCcetsWNryx_436myEGA9edkgmaaM Message-ID: Subject: Re: RFC: Logging plan of the running query To: torikoshia Cc: rafaelthca@gmail.com, pgsql-hackers@lists.postgresql.org, destrex271@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 31, 2025 at 9:43=E2=80=AFPM torikoshia wrote: > Previously, Rafael proposed a patch in this thread that added execution > progress tracking. However, I felt that expanding the scope could make > it harder to get the patch reviewed or committed. So, I suggested first > completing a feature that only retrieves the execution plan of a running > query, and then developing execution progress tracking afterward[3]. That's reasonable. Comparing the two patches, I think that you have correctly solved a couple of key problems that Rafael did not handle correctly. Specifically, I believe you have correctly implemented what Andres described i.e. use CFI to get control to do the wrapping and then from the ExecProcNode wrapper do the actual EXPLAIN, whereas I believe Rafael was doing the wrapping directly from the signal handler, which did not seem safe to me: http://postgr.es/m/CA+TgmobrzeDep+Z1BPQqGNsCqTQ8M58wNNKJB_8Lwpwbqbz3GQ@mail= .gmail.com I also like your version of (sub)transaction abort handling much better than the memory-context cleanup that Rafael initially chose. He's since revised that. That said, I think the view that Rafael proposes, with a periodically-updating version of the EXPLAIN ANALYZE output up to that point, could be extremely useful in some situations. To make that work, he mostly just hacked InstrStopNode(), although as I'm thinking about it, that probably doesn't handle all of the parallel query cases correctly. I'm somewhat inclined to hope that we eventually end up with both interfaces. > I was considering whether to introduce a GUC in this patch to allow for > prior setup before outputting the plan or to switch to Rafael's patch > after reviewing its details. However, since there isn=E2=80=99t much time= left > before the feature freeze, if you have already reviewed Rafael's patch > and there is a chance it could be committed, it would be better to focus > on that. I wasn't feeling very confident about my ability to get that patch committed before feature freeze. I don't want to rush into something that we might later regret. I'm going to spend a bit more time studying your patch next. -- Robert Haas EDB: http://www.enterprisedb.com