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 1tyBL9-003VAX-Fo for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Mar 2025 15:09:47 +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 1tyBL6-00Bdzu-KF for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Mar 2025 15:09:44 +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 1tyBL6-00Bdzm-AC for pgsql-hackers@lists.postgresql.org; Fri, 28 Mar 2025 15:09:44 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tyBL4-001dmD-1U for pgsql-hackers@postgresql.org; Fri, 28 Mar 2025 15:09:43 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43d04ea9d9aso10618865e9.3 for ; Fri, 28 Mar 2025 08:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743174581; x=1743779381; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Lw0v2GdTNIIrnW1t1+fZFypuIufKViqZRF3riVMdZcE=; b=cJnpGh3YKpFQsQLwfjSP/rfXJY/4B68scKZV5uNi2wQvFP6u4K1Ce2cLWqjRY/MN4c 9krUAQu0okfj966fhL0KS3Rbnj/DDjEdo5pfOE09F8Zpc1fnO4itTQBMH3VLiBPj/r1C CNGSZYnsjvCRGOBgsgXlS5EI0HUadKcjAio2xtti9IoWjGVrBcjU+Xx9FfNlrl22BZwz MlJLJ3za5AKBTtBE83xTJlLpBD9QWPIdy/5YVGVd39g+HPsrgg0or2+mLcaPz2reQE4m UMSfRph08xlwNTvGYxtYp1WZSjAgAR8a/Asbge2COXO0V+ZSEcx8lBET5bt5sAI91PDt TJ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743174581; x=1743779381; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Lw0v2GdTNIIrnW1t1+fZFypuIufKViqZRF3riVMdZcE=; b=t/Yo75xqJlf8ikOH0bjxuZCJ3amuAJGYbXa6EK60PBjUhdFKyCei4vKV8wONKIjfWx AwfZKdxUMFub8JjRKlCKLYGA6mjg2DK1Ox+J8A/pAkL9dw8aTWnm8aulYzjUXfCzwT2g Bfw63Y6A233gVQ8RtNZcEOLFzmkZebR4//tJVShR+ieTAboudcknYXJAAngRjB0MndP+ UTuJsTCSwyAQ18hVS1mjLFdpSdqvd0Kriswd5hDqVFW0gCnc15mxHQCfO3WNKb1NkiND TMqRAXo3JUwsUKc4HTtUtSRLQLkPzEofmbKWycUe/6rsjmU7uCo1BrXuJIe+0tCJ8HYT YCFQ== X-Gm-Message-State: AOJu0YxpZmoYR9/RUFWtba1M7etlvE46w+NYhqhklYoQTa07d7dtiKEs 0DKa68fBv8T4qp01nYKMPK/nrKPmmRjbxJiUyR713OdjK3IvivIJ8KeynTf+F4v/Lw== X-Gm-Gg: ASbGncsQTXpw9rkYFHXV1J/pNPoTq1XzA7NGnCIVt+U3dmkpHgIi7Xq3lDIto5TIGLM MgKq0TbF8vxCcDZJXfUbIV5mC6v0E0alN9ovRVtAhYq/FsEF0zKC7qm8nJV+6HAqSnggbkrJUC4 sZQt3m74+Sagk4CpCTMn+SZdnE7bzPyziQo8AFfUSJV3ps7PbVALyjo5bu89uf40FmTgmmjcTJW GwUbuGXggkI3Lb0E6jfO14/wt36kHpU4kgyBhyP/+eggVHXon9mFqK3mh/YoBrj8+hY7LAH1Y9w 5drZwl4DKbciEcMVJcqhlAnH0DLp7/F7z5HBhgXVgeP2CfIxiG0Cob4KF31mMwkG6uF1qvWVe// gNWg= X-Google-Smtp-Source: AGHT+IFquF6a8SP85KsBNH7Vl5qGiie29m3Yw/saqLPh7htK54Q8KrvibVyQQqtLUrZFu9uM1RnGvw== X-Received: by 2002:a05:600c:1c0e:b0:43c:fffc:7886 with SMTP id 5b1f17b1804b1-43d850a93c9mr76626065e9.8.1743174580502; Fri, 28 Mar 2025 08:09:40 -0700 (PDT) Received: from [192.168.0.89] (84.123.232.230.dyn.user.ono.com. [84.123.232.230]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d8fbc1716sm29801605e9.15.2025.03.28.08.09.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Mar 2025 08:09:39 -0700 (PDT) Message-ID: <4be5223e-4725-49a2-b49f-769f4f402984@gmail.com> Date: Fri, 28 Mar 2025 16:09:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Proposal: Progressive explain To: Rafael Thofehrn Castro , Robert Haas Cc: pgsql-hackers References: Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/26/25 22:57, Rafael Thofehrn Castro wrote: > So implementation was done based on transaction nested level. Cleanup is > only > performed when AbortSubTransaction() is called in the same transaction > nested > level as the one where the query is running. This covers both PL/pgSQL > exception > blocks and savepoints. Thanks for your efforts! Let me provide an alternative view of your code. Postgres has a massive gap between the start of the execution and the end. All the stuff that happens at that time can't be discovered. That's sad. If you add a new hook into the ExecuteNode (it may be designed as a pointer in the PlanState to affect only necessary nodes), you may push the code out of the core and give other extensions additional tools. I see your reasoning here [1], but I think with the commit 4fd02bf7cf9, it should be revised. As I see after reviewing your code, to design it as an extension, some parallel query execution stuff needs to be exported, and Instrumentation needs to be changed a little. For example, with progressive explain we have a new node state - 'not visited yet' that is different from 'not executed'. What is the purpose of a new hook from a broad perspective? I designed at least two features with such a hook in the Postgres fork: 1) real-time execution statistics and 2) query interruption on the arbitrary trigger (planning error detected, a signal arrived, too much temp memory allocated, etc.). I am not sure if it would be interesting for the community, but when a query is executed for more than one minute, I certainly want to control what is happening and have some tools except query abortion. The benefit of such an approach is that it is doable to change the Instrumentation, add a hook now, and develop this extension without a rush until it is stable - I think at least the case of parallel execution may be enhanced. [1] https://www.postgresql.org/message-id/CAG0ozMrtK_u8Uf5KNZUmRNuMphV5tnC5DEhRBNRGK%2BK4L506xw%40mail.gmail.com -- regards, Andrei Lepikhov