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 1lmEaf-0003Pk-BQ for pgsql-hackers@arkaria.postgresql.org; Thu, 27 May 2021 11:54:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lmEad-0001FF-IV for pgsql-hackers@arkaria.postgresql.org; Thu, 27 May 2021 11:54:15 +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 1lmEad-0001F7-Aw for pgsql-hackers@lists.postgresql.org; Thu, 27 May 2021 11:54:15 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lmEab-0003Ve-6p for pgsql-hackers@lists.postgresql.org; Thu, 27 May 2021 11:54:14 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id C9FAE21C79B8; Thu, 27 May 2021 14:54:11 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1622116451; bh=8Yy5nhxikwWwBxwmmnTvBXPbkIf0jO60CikSQQSJXLA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=pkKudsYj0FNXPawCRACRfuYF3r63ZE63oKqZAMm3e5hH5jI/asnYMPFmpVRHrH9Ku DWXzwH3uUKcP3C48I/kH8TE1vfACHpEQoKOofiZI6aEPDejoBix6ir2tmKmKRMrifo MYK+bvio8SOaiUMZuRlVG4MvSsd1S50VumrRhbiU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 27 May 2021 14:54:11 +0300 From: Yura Sokolov To: Tom Lane Cc: Alvaro Herrera , pgsql-hackers@lists.postgresql.org Subject: Re: Add PortalDrop in exec_execute_message In-Reply-To: <1664095.1622063992@sss.pgh.pa.us> References: <202105262059.dnf27qpnccuv@alvherre.pgsql> <1664095.1622063992@sss.pgh.pa.us> User-Agent: Roundcube Webmail/1.4.0 Message-ID: X-Sender: y.sokolov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom Lane wrote 2021-05-27 00:19: > Alvaro Herrera writes: >> (I didn't add a Close Portal message to PQsendQueryInternal in >> pipeline >> mode precisely because there is no such message in PQsendQueryGuts. >> I think it would be wrong to unconditionally add a Close Portal >> message >> to any of those places.) > > Yeah, I'm not very comfortable with having libpq take it on itself > to do that, either. But... Tom Lane wrote 2021-05-21 21:23: > I'm inclined to think that your complaint would be better handled > by having the client send a portal-close command, if it's not > going to do something else immediately. And given PQsendQueryParams should not be different from PQsendQuery (aside of parameters sending) why shouldn't it close its portal immediately, like it happens in exec_simple_query ? I really doubt user of PQsendQueryPrepared is aware of portal as well since it is also unnamed and also exhausted (because PQsendQueryGuts always sends "send me all rows" limit). And why PQsendQueryInternal should behave differently in pipelined and not pipelined mode? It closes portal in not pipelined mode, and will not close portal of last query in pipelined mode (inside of transaction). > Looking back at the original complaint, it seems like it'd be fair to > wonder why we're still holding a page pin in a supposedly completed > executor run. Maybe the right fix is somewhere in the executor > scan logic. Perhaps because query is simple and portal is created as seek-able? > > regards, tom lane regards Yura Sokolov