Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFzEC-0005ts-4y for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Oct 2018 10:20:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gFzE9-00056L-BB for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Oct 2018 10:20:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFzE8-00054z-Vu; Fri, 26 Oct 2018 10:20:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFzE2-0006Pa-0H; Fri, 26 Oct 2018 10:20:23 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9QAKDY9001038; Fri, 26 Oct 2018 06:20:14 -0400 From: Tom Lane To: Amit Langote cc: Bruno Wolff III , pgsql-general@lists.postgresql.org, pgsql-hackers@lists.postgresql.org Subject: Re: Should pg 11 use a lot more memory building an spgist index? In-reply-to: References: <20181024012314.GA27428@wolff.to> <19003.1540370028@sss.pgh.pa.us> <20181024083748.GA3296@wolff.to> <19088.1540372871@sss.pgh.pa.us> <20181025174306.GA3184@wolff.to> <24288.1540545369@sss.pgh.pa.us> <0e2b1baa-3d1c-7204-faa5-72c5d4a21a98@lab.ntt.co.jp> <25595.1540547983@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Fri, 26 Oct 2018 19:08:44 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25755.1540549213.1@sss.pgh.pa.us> Date: Fri, 26 Oct 2018 11:20:13 +0100 Message-ID: <25756.1540549213@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > On 2018/10/26 18:59, Tom Lane wrote: >> After a quick look around, I think that making systable_begin/endscan >> do this is a nonstarter; there are just too many call sites that would >> be affected. Now, you could imagine specifying that indexes on system >> catalogs (in practice, only btree) have to clean up at endscan time >> but other index types don't, so that only operations that might be >> scanning user indexes need to have suitable wrapping contexts. Not sure >> there's a lot of benefit to that, though. > By "core code", I didn't mean systable_being/endscan, but rather > check_exclusion_or_unique_constraint() or its core-side caller(s). Well, we'd need to consider any call path leading to index_endscan. One of those is systable_endscan and its multitude of callers. It seems unlikely that you could just switch context in systable_beginscan without breaking many of the callers. If we forbade leaks in system catalog index AMs, then the number of places that would need work would be manageable (about 3, it looked like). But then it seems more like a wart than a real API improvement. regards, tom lane