pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: DSM segment handle generation in background workers
Date: Mon, 12 Nov 2018 09:39:01 -0500
Message-ID: <32455.1542033541@sss.pgh.pa.us> (raw )
In-Reply-To: <CAEepm=1+1jZiNHuRKaHgKZz1f=RFd8BnFpSgVsxEFNafjsqWZg@mail.gmail.com >
References: <CAEepm=2eJj_6=B+2tEpGu2nf1BjthCf9nXXUouYvJJ4C5WSwhg@mail.gmail.com >
<CAEepm=1oRxe3n3a6bq23-2MQTSWagHTghPbpGJ1YcZEyZ_KWQA@mail.gmail.com >
<17043.1539046409@sss.pgh.pa.us >
<CAEepm=2RqzvRyEXWxq8B9zR8p45tt-xsvA4S8ZNKNwpiUzMVKA@mail.gmail.com >
<CAEepm=1xxETRCZexNSxkABpNg-65U6Z2pxynJ8V0vURqob+Rqw@mail.gmail.com >
<9879.1539233472@sss.pgh.pa.us >
<CAEepm=20PEf5bM3FAtD=CL7x0_WxFXfQ4Se9N9nConKucsr8pg@mail.gmail.com >
<20181112083358.GA1073796@rfd.leadboat.com >
<CAEepm=1+1jZiNHuRKaHgKZz1f=RFd8BnFpSgVsxEFNafjsqWZg@mail.gmail.com >
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Mon, Nov 12, 2018 at 9:34 PM Noah Misch <noah@leadboat.com> wrote:
>> Compared to the old code, the new code requires more wall time to visit every
>> possible seed value. New code xor's the PID bits into the fastest-changing
>> timestamp bits, so only about twenty bits can vary within any given one-second
>> period. (That assumes a PID space of twenty or fewer bits; fifteen bits is
>> the Linux default.) Is that aspect of the change justified?
> Hmm, right. How about applying pg_bswap32() to one of the terms, as
> an easy approximation of reversing the bits?
I doubt that's a good idea; to a first approximation, it would mean that
half the seed depends only on the PID and the other half only on the
timestamp. Maybe we could improve matters a little by left-shifting the
PID four bits or so, but I think we still want it to mix with some
rapidly-changing time bits.
I'm not really sure that we need to do anything though. Basically,
what we've got here is a tradeoff between how many bits change over
a given timespan and how unpredictable those bits are. I don't see
that one of those is necessarily more important than the other.
regards, tom lane
view thread (19+ messages) latest in thread
Message-ID: <32455.1542033541@sss.pgh.pa.us>
Permalink: ../32455.1542033541@sss.pgh.pa.us/
Also on: postgresql.org/message-id/32455.1542033541@sss.pgh.pa.us
copy link · copy postgr.es
reply 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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, noah@leadboat.com
Subject: Re: DSM segment handle generation in background workers
In-Reply-To: <32455.1542033541@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