pgbench - add pseudo-random permutation function - Mailing list pgsql-hackers

From Fabien COELHO
Subject pgbench - add pseudo-random permutation function
Date
Msg-id alpine.DEB.2.21.1807280944370.5142@lancre
Whole thread Raw
Responses Re: pgbench - add pseudo-random permutation function  (Hironobu SUZUKI <hironobu@interdb.jp>)
List pgsql-hackers
Hello,

This patch adds a pseudo-random permutation function to pgbench. It allows 
to mix non uniform random keys to avoid trivial correlations between 
neighboring values, hence between pages.

The function is a simplistic form of encryption adapted to any size, using 
a few iterations of scramble and scatter phases. The result is not 
cryptographically convincing, nor even statistically, but it is quite 
inexpensive and achieves the desired result. A computation costs 0.22 µs 
per call on my laptop, about three times the cost of a simple function.

Alternative designs, such as iterating over an actual encryption function 
or using some sbox, would lead to much more costly solutions and complex 
code.

I also join a few scripts I used for testing.

-- 
Fabien.
Attachment

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Removing useless \. at the end of copy in pgbench
Next
From: Ioseph Kim
Date:
Subject: modify: request for new parameter for disable promote (slave onlymode)