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 1kamcA-0003In-1i for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Nov 2020 21:16:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kamc8-0006lU-W8 for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Nov 2020 21:16:12 +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 1kamc8-0006lK-PL for pgsql-hackers@lists.postgresql.org; Thu, 05 Nov 2020 21:16:12 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kamc5-0001gi-E5 for pgsql-hackers@postgresql.org; Thu, 05 Nov 2020 21:16:12 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 10FCC5C00B0; Thu, 5 Nov 2020 16:16:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 05 Nov 2020 16:16:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=OJlD2ETDpVM9ysIVS TACLcEWOFgOpeHPFbDdq7fZ/b0=; b=N5jbCF2c6kLH1xBw7X4/xkf4ChnSjfMgh Xr7uukfhVWunLIzfNB8QZwfLSgVBfQAKtekaokDpxNh0QhRs9DXkGXykQt8prA7b 6uT5TNZhUCUSK9VSwx9mKqZMWOkdY7E8vbqfb4JPLBV6ii4qDmOcNnkbOlqCF6uX d/1f0opB+s1EuHaf8Knt3wrHBQM8cnmJkMfwIvx7234DuWRQEwmB0Tvf04ns3XdJ mhb7cmm8SaVpJPX28HsXtQr55ePDhmflJNAWRnThYFkCLooSeAmnI6akugfGX9/F bQw6u5Lg4EVe8JvrXdFPtr8TpZpj6iR7cXZF1Rl4kvm6lZD96+Mjg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtjedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtuggjfgesthdtredttdervdenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvefgleevgeeujeeghfegteeghfegheeifeehheelteet ieduieeihffggfehffetnecukfhppeduledtrdelhedrudelrddugeeknecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegr lhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.148]) by mail.messagingengine.com (Postfix) with ESMTPA id 63F1A306005F; Thu, 5 Nov 2020 16:16:07 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id CB35C2A1005; Thu, 5 Nov 2020 18:16:04 -0300 (-03) Date: Thu, 5 Nov 2020 18:16:04 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: Fix brin_form_tuple to properly detoast data Message-ID: <20201105211604.GA3054@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21cacd39-1ca2-54ef-4f3e-ac493238832c@enterprisedb.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Nov-05, Tomas Vondra wrote: > On 11/5/20 6:17 PM, Alvaro Herrera wrote: > > There are recent changes in vacuum for temp tables (commit 94bc27b57680?) > > that would maybe make this stable enough, without having to have the CIC > > there. At least, I tried it locally a few times and it appears to work well. > > This won't work for older releases though, just master. This is patch > > 0001 attached here. > > IIUC you're suggesting to use a temporary table in the test? Unfortunately, > this does not work on older releases, and IMHO the test should be > backpatched too. IMHO the CIC "hack" is acceptable, unless there's a better > solution that I'm not aware of. Oh, sure, the CIC hack is acceptable for the older branches. I'm just saying that you can use a temp table everywhere, and keep CIC in the old branches and no CIC in master. > This got me thinking though - wouldn't it be better to handle too large > values by treating the range as "degenerate" (i.e. store NULL and consider > it as matching all queries), instead of failing the CREATE INDEX or DML? I > find the current behavior rather annoying, because it depends on the other > rows in the page range, not just on the one row the user deals with. Perhaps > this might even be considered an information leak about the other data. Of > course, not something this patch should deal with. Hmm. Regarding text I remember thinking we could just truncate values (as we do for LIKE, as I recall). I suppose that strategy would work even for bytea. > > > +/* > > > + * This enables de-toasting of index entries. Needed until VACUUM is > > > + * smart enough to rebuild indexes from scratch. > > > + */ > > > > ... because, surely, we're now never working on having VACUUM rebuild > > indexes from scratch. In fact, I wonder if we need the #define at > > all. I propose to remove all those #ifdef lines in your patch. > > That's a verbatim copy of a comment from indextuple.c. IMHO we should keep > it the same in both places. Sure, if you want to. > > The fix looks good to me. I just added a comment in 0003. > > Thanks. Any opinions on fixing this in existing clusters? Any better ideas > than just giving users the SQL query to list possibly-affected indexes? None here.