pgbench - add pseudo-random permutation function

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pgbench - add pseudo-random permutation function
Date: 2018-07-28 14:03:49
Message-ID: alpine.DEB.2.21.1807280944370.5142@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
pgbench-prp-func-1.patch text/plain 11.1 KB
prp_init.sql application/x-sql 245 bytes
prp_analyse.sql application/x-sql 264 bytes
prp_gen_vals.sql application/x-sql 348 bytes
prp_test_2.sql application/x-sql 243 bytes
prp_test_3.sql application/x-sql 245 bytes
prp_test_4.sql application/x-sql 284 bytes
prp_test_5.sql application/x-sql 324 bytes
prp_test_6.sql application/x-sql 381 bytes
prp_test_n.sql application/x-sql 274 bytes
prp_perf.sql application/x-sql 303 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ioseph Kim 2018-07-28 14:56:36 modify: request for new parameter for disable promote (slave only mode)
Previous Message Fabien COELHO 2018-07-28 13:44:21 Re: Removing useless \. at the end of copy in pgbench