Re: Sequential vs. random values - number of pages in B-tree

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: pinker <pinker(at)onet(dot)eu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sequential vs. random values - number of pages in B-tree
Date: 2016-08-18 16:41:21
Message-ID: CA+bJJbxuoWUVfnh7FvpD53zSF93wzcdkeSwh4FwsRyuUzO=yug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daniel:
On Thu, Aug 18, 2016 at 5:24 PM, Daniel Verite <daniel(at)manitou-mail(dot)org> wrote:
>> unless you know of an easy way to generate a random permutation on the
>> fly without using a lot of memory, I do not.
> It could be done by encrypting the stream.
> For 32 bits integers:
> https://wiki.postgresql.org/wiki/Skip32
> For 64 bits integers:
> https://wiki.postgresql.org/wiki/XTEA

Nearly, probably good enough for tests, but only generates a
pseudorandom permutation if you encrypt 2**32/64 values, not with the
1..1E7 range, it will map them into 1E7 different numbers in the range
2**32/64. I think there are some pseudo-random number generators which
can be made to work with any range, but do not recall which ones right
now.

Francisco Olarte.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Lybarger 2016-08-18 17:10:16 foreign key with where clause
Previous Message Daniel Verite 2016-08-18 15:24:37 Re: Sequential vs. random values - number of pages in B-tree