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 1l1F0n-0007IU-6A for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 20:51:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1F0m-0003b4-3S for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 20:51:00 +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 1l1F0l-0003aw-SY for pgsql-hackers@lists.postgresql.org; Sun, 17 Jan 2021 20:50:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1F0j-0002GH-JD for pgsql-hackers@postgresql.org; Sun, 17 Jan 2021 20:50:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10HKoV90234864; Sun, 17 Jan 2021 15:50:32 -0500 From: Tom Lane To: Heikki Linnakangas cc: Andrey Borodin , Peter Geoghegan , Justin Pryzby , =?UTF-8?Q?Darafei_Kom=d1=8fpa_Praliaskouski?= , Pavel Borisov , Thomas Munro , Michael Paquier , Alexander Korotkov , PostgreSQL Hackers Subject: Re: Yet another fast GiST build In-reply-to: References: <7d9158ca-d7cb-88f0-dbbd-1d5cec32b1ae@iki.fi> <85df399a-e8a4-2369-f723-fd1a3a872575@iki.fi> <884200.1600634472@sss.pgh.pa.us> <891385.1600636205@sss.pgh.pa.us> <20200920224446.GF30557@telsasoft.com> <896113.1600643169@sss.pgh.pa.us> <8269ca22-d275-0afe-633c-2342c7ba11e6@iki.fi> <47CD54A6-EE59-433A-96E2-6F4E5973CEF4@yandex-team.ru> <422beff9-0e01-9ce6-edb9-c2a2289e8eb9@iki.fi> <0A1DDF47-CAB7-4D6A-9677-B1800FFB6984@yandex-team.ru> <4D68C21F-9FB9-41DA-B663-FDFC8D143788@yandex-team.ru> <4098005f-e4b5-5904-4b33-335dd106c132@iki.fi> <059BD785-A6CE-4E34-B80B-38E9E0309B78@yandex-team.ru> <8ACF61CC-32ED-4B4B-A2BC-15264E02D24E@yandex-team.ru> <3E4F9093-A1B5-4DF8-A292-0B48692E3954@yandex-team.ru> <9FCEC1DC-86FB-4A57-88EF-DD13663B36AF@yandex-team.ru> Comments: In-reply-to Heikki Linnakangas message dated "Wed, 13 Jan 2021 10:41:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <234862.1610916631.1@sss.pgh.pa.us> Date: Sun, 17 Jan 2021 15:50:31 -0500 Message-ID: <234863.1610916631@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Heikki Linnakangas writes: > On 12/01/2021 18:19, Andrey Borodin wrote: >> Thanks! Looks good to me. > Pushed, thanks! I noticed that gist_page_items() thinks it can hold inter_call_data->rel open across a series of calls. That's completely unsafe: the executor might not run the call series to completion (see LIMIT), resulting in relcache leak complaints. I suspect that it might have cache-flush hazards even without that. I think this code needs to be rewritten to do all the interesting work in the first call. Or maybe better, return the results as a tuplestore so you don't have to do multiple calls at all. regards, tom lane