From: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
To: amborodin@acm.org
To: Alvaro Herrera <alvherre@2ndquadrant.com>
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: Fri, 5 Aug 2016 19:19:49 +0300
Message-ID: <a3ceb430-97ff-aa65-fade-a8daaa55fcc5@postgrespro.ru> (raw)
In-Reply-To: <CAJEAwVHDCpp=5ivz7_NAT4dG1kXG13KR6MX+spt9Q1u=j3BpVw@mail.gmail.com>
References: <CAJEAwVGdQXjYhdX=Q4r=jx6KGbRKBC-hCF_gO5nmaxdYPHekQQ@mail.gmail.com>
<20160725015209.GA240901@alvherre.pgsql>
<CAJEAwVHDCpp=5ivz7_NAT4dG1kXG13KR6MX+spt9Q1u=j3BpVw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
30.07.2016 14:00, Andrew Borodin:
> Here is BRIN-compatible version of patch. Now function
> PageIndexTupleOverwrite consumes tuple size as a parameter, this
> behavior is coherent with PageAddItem.
> Also, i had to remove asserstion that item has a storage in the loop
> that adjusts line pointers. It would be great if someone could check
> that place (commented Assert(ItemIdHasStorage(ii)); in
> PageIndexTupleOverwrite). I suspect that there might be a case when
> linp's should not be adjusted.
Hi, I reviewed the code and I have couple of questions about
following code:
/* may have negative size here if new tuple is larger */
size_diff = oldsize - alignednewsize;
offset = ItemIdGetOffset(tupid);
if (offset < phdr->pd_upper || (offset + size_diff) >
phdr->pd_special ||
offset != MAXALIGN(offset) || size_diff != MAXALIGN(size_diff))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg("corrupted item offset: offset = %u, size = %u",
offset, (unsigned int) size_diff)));
First of all, shouldn't we use MAXALIGN(oldsize) instead of oldsize?
Although, I'm quite sure that it was already aligned somewhere before.
I doubt that the check (size_diff != MAXALIGN(size_diff)) is necessary.
I'd rather add the check: (offset+size_diff < pd_lower).
Besides that moment, the patch seems pretty good.
BTW, I'm very surprised that it improves performance so much.
And also size is reduced significantly. 89MB against 289MB without patch.
Could you explain in details, why does it happen?
--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
--
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: a.lubennikova@postgrespro.ru, amborodin@acm.org, alvherre@2ndquadrant.com, 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: <a3ceb430-97ff-aa65-fade-a8daaa55fcc5@postgrespro.ru>
References: <CAJEAwVGdQXjYhdX=Q4r=jx6KGbRKBC-hCF_gO5nmaxdYPHekQQ@mail.gmail.com> <20160725015209.GA240901@alvherre.pgsql> <CAJEAwVHDCpp=5ivz7_NAT4dG1kXG13KR6MX+spt9Q1u=j3BpVw@mail.gmail.com> <a3ceb430-97ff-aa65-fade-a8daaa55fcc5@postgrespro.ru>
* 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