Re: Reduce pinning in btree indexes

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: andrew(at)tao11(dot)riddles(dot)org(dot)uk
Cc: kgrittn(at)ymail(dot)com, hlinnakangas(at)vmware(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reduce pinning in btree indexes
Date: 2015-02-27 08:14:24
Message-ID: 20150227.171424.243842803.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Just a reminder, but I am not the author of this patch:)

At Fri, 27 Feb 2015 07:26:38 +0000, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote in <87zj7z6ckc(dot)fsf(at)news-spur(dot)riddles(dot)org(dot)uk>
> >>>>> "Kyotaro" == Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> writes:
>
> >> You might want to try running the same test, but after patching
> >> ExecSupportsMarkRestore to return false for index scans. This will
> >> cause the planner to insert a Materialize node to handle the
> >> mark/restore.
>
> Kyotaro> Mmm? The patch bt-nopin-v1.patch seems not contain the change
> Kyotaro> for ExecSupportMarkRestore and the very simple function remain
> Kyotaro> looking to return true for T_Index(Only)Scan after the patch
> Kyotaro> applied.
>
> Right. I'm suggesting you change that, in order to determine what
> performance cost, if any, would result from abandoning the idea of doing
> mark/restore entirely.

I understand that you'd like to see the net drag of performance
by the memcpy(), right?

That don't seem to be possible without breaking (a part of) the
patch's function, but, concerning btmarkpos() only case, the mark
struct can have garbage so only changing refcount would be viable
to see the pure loss by the memcpy().

The attached patch is the destruction I did, and the result was
like below.

> Case 2. 1M markpos, no restorepos for 1M result rows.
>
> IndesOnly scan: The patches loses about 10%.
> master: 3655 ms (std dev = 2.5 ms)
> Patched: 4038 ms (std dev = 2.6 ms)

Patched: 4036 ms (std dev = 3.5 ms)
Broken: 3718 ms (std dev = 1.6 ms)

The "Patched" just above is the retook numbers. It's a little
under 9% loss from "broken" version. That is the pure drag of
memcpy(). This seems quite big as Heikki said. It's an extreme
case, though.

The rest 1.7% should be the share of all the other stuff.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
bt_nopin_nomemcpy.patch text/x-patch 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-02-27 08:27:37 Re: Reduce pinning in btree indexes
Previous Message Andrew Gierth 2015-02-27 07:26:38 Re: Reduce pinning in btree indexes