From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: amborodin@acm.org
Cc: Andrew Borodin <borodin@octonica.com>
Cc: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Oleg Bartunov <obartunov@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Sergey Mirvoda <sergey@mirvoda.com>
Subject: Re: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC]
Date: Thu, 08 Sep 2016 17:49:01 -0400
Message-ID: <6573.1473371341@sss.pgh.pa.us> (raw)
In-Reply-To: <20160908212300.GA61876@alvherre.pgsql>
References: <20160908212300.GA61876@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Alvaro Herrera <alvherre@2ndquadrant.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, amborodin@acm.org, borodin@octonica.com, a.lubennikova@postgrespro.ru, michael.paquier@gmail.com, amit.kapila16@gmail.com, a.korotkov@postgrespro.ru, obartunov@gmail.com, hlinnaka@iki.fi, sergey@mirvoda.com
Subject: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC]
In-Reply-To: <6573.1473371341@sss.pgh.pa.us>
References: <20160908212300.GA61876@alvherre.pgsql> <6573.1473371341@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox