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

From Fabien COELHO
Subject Re: pgbench - add pseudo-random permutation function
Date
Msg-id alpine.DEB.2.21.2004051422020.16227@pseudo
Whole thread Raw
In response to Re: pgbench - add pseudo-random permutation function  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
> Attached is an attempt at improving things. I have added a explicit note and 
> hijacked an existing example to better illustrate the purpose of the 
> function.

A significant part of the complexity of the patch is the overflow-handling 
implementation of (a * b % c) for 64 bits integers.

However this implementation is probably never used because int128 bits are 
available and the one line implementation takes precedence, or the size is 
small enough (less than 48 bits) so that there are no overflows with the 
primes involved, thus the operation is done directly on 64 bits integers.

I could remove the implementation and replace it with a "not available on 
this architecture" message, which would seldom be triggered: you would 
have to use a 32 bits arch (?) and test against a table with about 262 
Trows, which I guess does not exists anywhere. This approach would remove 
about 40% of the code & comments.

Thougths?

-- 
Fabien.



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Improving connection scalability: GetSnapshotData()
Next
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)