Re: Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: Sokolov Yura <funny(dot)falcon(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)
Date: 2017-08-11 18:05:08
Message-ID: CA+TgmoaUAzx-W5A-PvH4S9xTF40zgo1B4ve-Ua8aFR-go91yWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 10, 2017 at 11:12 AM, Alexander Korotkov
<a(dot)korotkov(at)postgrespro(dot)ru> wrote:
> These results look very cool!
> I think CSN is eventually inevitable, but it's a long distance feature.
> Thus, this optimization could make us a good serve before we would have CSN.
> Do you expect there are cases when this patch causes slowdown? What about
> case when we scan each xip array only once (not sure how to simulate that
> using pgbench)?

Just a random thought here:

The statements pgbench executes are pretty simple: they touch one row
in one table. You wouldn't expect them to scan the xip array very
many times. If even those statements touch the array enough for this
to win, it seems like it might be hard to construct an even worse
case. I might be missing something, though.

We're not going to accept code like this, though:

+ d = xip[i] >> 6;
+ j = k = xip[i] & mask;
+ while (xiphash[j] != InvalidTransactionId)
+ {
+ j = (k + d) & mask;
+ d = d*5 + 1;
+ }

Single-character variable names, hard-coded constants, and no comments!

I kind of doubt as a general point that we really want another
open-coded hash table -- I wonder if this could be made to use
simplehash.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-11 18:07:56 Re: Parallel COPY FROM execution
Previous Message Robert Haas 2017-08-11 17:20:43 Re: reload-through-the-top-parent switch the partition table