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 1rdsWT-00813c-PN for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 13:57:02 +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 1rdsWS-004tfp-0F for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 13:57:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdsWR-004te5-Kw for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 13:57:00 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rdsWN-000gg2-CS for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 13:56:57 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-512bc0e8ce1so1405552e87.0 for ; Sat, 24 Feb 2024 05:56:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783014; x=1709387814; 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=6sekGrjX8Ons1w3XeLNwZBvQegYVqyKRgzf7g/icdOM=; b=DdE9zfN5Pq1Of74VTn3I7M16xVDzmYvyybuEtpUcxYtRG/O0REl+z7Ybt/hF4qWsee rD/NjIyy5dQSKDeMQD0yi+3ONm8mP8OebU4kZMHFkLpnKb9gslurA8FvKSNJ4oxJRLeI d0lsz0+6I0t9Ft6gOBcOrs8Tu3ZZRe4oAdVTJkOdgMO2pO/JxeT0P4poug5cXcQJjt5h Gbn5vDdmlXyMBUkwyQ38bQO7sM9/a+2CsFlmnmpddBpZjYfVnvXXOesrd3BStJhNpPj9 hPx8P33TT58cE8d4XZ+iREu4MTajCAUHjAfB/glgzvveO5hyyPWJbta0Uk7YZWzdx8GZ uRag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783014; x=1709387814; 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=6sekGrjX8Ons1w3XeLNwZBvQegYVqyKRgzf7g/icdOM=; b=S+6/Lv5qmf7sr9mJZPxSCndE2ixW7QCa0oF/MnlwZruI+/PZGUemjkA+pJIRVfUQZ5 lM7VvwO7uDzCcZhTmF426jFAyQiCmN0vJWwlSvkoQUPKxpRL/JHSbIqP5dbqgq+WAjP2 14HygvLF28eDl9p6OlszjPqU+6X7E2xLM4F4P1aVYpfvj6u0s5ADHIYVtE78+SFJeGqm zByKCTCsFXf70j3ZpNq9+2bGnJoUd997ChrjMWRfDKgG7VgOgmU0aF5ZiF0b50lFYfUp jWPhBGVBWr7IE0BOAnVcDYK5vjH2xfzR0UkV02zPMvgyEWcv0smJ/RwMlTnaOvNcJbyn Cvkw== X-Forwarded-Encrypted: i=1; AJvYcCVJ9yEgrTG7+P9EWfz/kAOIB70bQpBQCDvsxpv2q2gsmNijCWrd3JvB85vrykiupzTzP/MswYpg9z+jPWjI6RARZDqvDG0cPrQExc2UCkqme/Nc X-Gm-Message-State: AOJu0YwbGumyoE1NhhtoECKTh9logWik94FnPfOZtSUZQAhrJJ3S0j+i p53j2Aqvvves2/KndcJqCswfmsrNiCiibf+LXDrkldj3w/0hwF3RYNNgNkpVlLl5zg3WcsKG3K4 IkLx9WPhTeBl9hd0pDN0UzdBuXuc= X-Google-Smtp-Source: AGHT+IGVZCMkAN3Ph9HLQJCto88JbHCcA+U0qZ4P86pz/grEBYXs7FXM1gxmdHWnnYWF04A7RVPVm/nGvTCIcelTe4E= X-Received: by 2002:a05:6512:4005:b0:512:ebaa:30f with SMTP id br5-20020a056512400500b00512ebaa030fmr1999402lfb.5.1708783013563; Sat, 24 Feb 2024 05:56:53 -0800 (PST) MIME-Version: 1.0 References: <61b4add9a01f21011789b6ee04085751@oss.nttdata.com> <3d5fd6d955944b5e8e4b8d1917f14885@oss.nttdata.com> <67fac921c935d7b9db51609a7599520f@oss.nttdata.com> <20240215185911.v4o6fo444md6a3w7@awork3.anarazel.de> In-Reply-To: From: James Coleman Date: Sat, 24 Feb 2024 08:56:41 -0500 Message-ID: Subject: Re: RFC: Logging plan of the running query To: Robert Haas Cc: Julien Rouhaud , Andres Freund , torikoshia , pgsql-hackers@lists.postgresql.org, =?UTF-8?Q?=C3=89tienne_BERSAC?= , ashutosh.bapat.oss@gmail.com, rafaelthca@gmail.com, jian.universality@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 Fri, Feb 23, 2024 at 10:23=E2=80=AFAM Robert Haas wrote: > > On Fri, Feb 23, 2024 at 7:50=E2=80=AFPM Julien Rouhaud wrote: > > On Fri, Feb 23, 2024 at 10:22:32AM +0530, Robert Haas wrote: > > > On Thu, Feb 22, 2024 at 6:25=E2=80=AFAM James Coleman wrote: > > > > This is potentially a bit of a wild idea, but I wonder if having so= me > > > > kind of argument to CHECK_FOR_INTERRUPTS() signifying we're in > > > > "normal" as opposed to "critical" (using that word differently than > > > > the existing critical sections) would be worth it. > > > > > > It's worth considering, but the definition of "normal" vs. "critical" > > > might be hard to pin down. Or, we might end up with a definition that > > > is specific to this particular case and not generalizable to others. > > > > But it doesn't have to be all or nothing right? I mean each call could= say > > what the situation is like in their context, like > > CHECK_FOR_INTERRUPTS(GUARANTEE_NO_HEAVYWEIGHT_LOCK | GUARANTEE_WHATEVER= ), and > > slowly tag calls as needed, similarly to how we add already CFI based o= n users > > report. > > Absolutely. My gut feeling is that it's going to be simpler to pick a > small number of places that are safe and sufficient for this > particular feature and add an extra call there, similar to how we do > vacuum_delay_point(). The reason I think that's likely to be better is > that it will likely require changing only a relatively small number of > places. If we instead start annotating CFIs, well, we've got hundreds > of those. That's a lot more to change, and it also inconveniences > third-party extension authors and people doing back-patching. I'm not > here to say it can't work; I just think it's likely not the easiest > path. Yes, I suspect it's not the easiest path. I have a small hunch it might end up paying more dividends in the future: there isn't just one of these things that is regularly a thorny discussion for the same reasons each time (basically "no way to trigger this safely from another backend interrupting another one at an arbitrary point"), and if we were able to generalize a solution we may have multiple wins (a very obvious one in my mind is the inability of auto explain to run an explain at the precise time it's most useful: when statement timeout fires). But it's also possible there are simply ways that get us more than this scenario also, so I might be wrong; it's merely a hunch. Regards, James Coleman