pgbench - add pseudo-random permutation function
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-07-28T14:03:49Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pgbench: Function to generate random permutations.
- 6b258e3d688d 14.0 landed
-
Add basic support for using the POPCNT and SSE4.2s LZCNT opcodes
- 711bab1e4d19 12.0 cited
-
Further improve code for probing the availability of ARM CRC instructions.
- a7a7387575b8 11.0 cited
Attachments
- pgbench-prp-func-1.patch (text/plain) patch
- prp_init.sql (application/x-sql)
- prp_analyse.sql (application/x-sql)
- prp_gen_vals.sql (application/x-sql)
- prp_test_2.sql (application/x-sql)
- prp_test_3.sql (application/x-sql)
- prp_test_4.sql (application/x-sql)
- prp_test_5.sql (application/x-sql)
- prp_test_6.sql (application/x-sql)
- prp_test_n.sql (application/x-sql)
- prp_perf.sql (application/x-sql)
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.