Re: Sequential vs. random values - number of pages in B-tree - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Sequential vs. random values - number of pages in B-tree
Date
Msg-id CA+bJJbxuoWUVfnh7FvpD53zSF93wzcdkeSwh4FwsRyuUzO=yug@mail.gmail.com
Whole thread Raw
In response to Re: Sequential vs. random values - number of pages in B-tree  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: Sequential vs. random values - number of pages in B-tree  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-general
Daniel:
On Thu, Aug 18, 2016 at 5:24 PM, Daniel Verite <daniel@manitou-mail.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.


pgsql-general by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Sequential vs. random values - number of pages in B-tree
Next
From: Mark Lybarger
Date:
Subject: foreign key with where clause