Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bi7CE-0001vq-0E for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Sep 2016 21:49:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bi7CD-0001RQ-2D for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Sep 2016 21:49:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bi7CC-0001RJ-Ft for pgsql-hackers@postgresql.org; Thu, 08 Sep 2016 21:49:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bi7C9-0003RI-Le for pgsql-hackers@postgresql.org; Thu, 08 Sep 2016 21:49:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u88Ln1uK006574; Thu, 8 Sep 2016 17:49:01 -0400 From: Tom Lane To: Alvaro Herrera cc: amborodin@acm.org, Andrew Borodin , Anastasia Lubennikova , Michael Paquier , Amit Kapila , Alexander Korotkov , pgsql-hackers , Oleg Bartunov , Heikki Linnakangas , Sergey Mirvoda Subject: Re: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC] In-reply-to: <20160908212300.GA61876@alvherre.pgsql> References: <20160908212300.GA61876@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 08 Sep 2016 18:23:00 -0300" Date: Thu, 08 Sep 2016 17:49:01 -0400 Message-ID: <6573.1473371341@sss.pgh.pa.us> X-Pg-Spam-Score: -3.0 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> That comment seems utterly wrong to me, because both PageIndexTupleDelete >> and PageIndexMultiDelete certainly contain assertions that every item on >> the page has storage. Are you expecting that any BRIN index items >> wouldn't? If they wouldn't, is adjusting their lp_off as if they did >> have storage sensible? > It is possible in BRIN to have empty intermediate tuples; for example it > is possible for lp 1 and 3 to contain index tuples, while lp 2 does not. Hm. So apparently, the only reason this stuff works at all is that BRIN isn't using either PageIndexTupleDelete or PageIndexMultiDelete. > Now if this loop is concerned only with live lps and does not move lps, > then it should be fine to add the assertion. No, it iterates over all lps on the page. I'm inclined to think it should be written like if (ItemIdHasStorage(ii) && ItemIdGetOffset(ii) <= offset) ii->lp_off += size_diff; because futzing with the lp_off field in an item that isn't really pointing at storage feels wrong. We might need to do that to PageIndexTupleDelete and/or PageIndexMultiDelete someday, too. I notice that PageIndexDeleteNoCompact, which seems to express what BRIN is expecting in a rather underdocumented way, forces any items without storage into "unused" state. I don't really think it's bufpage.c's place to do that, though. Do you think that code is actually supposed to fire, or is it just there for lack of a better idea? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers