Partition by hash formula
Partition by hash formula
От:
Vlad Bokov <vlad@razum2um.me>
Дата:
Hello, recently I read https://blog.dbi-services.com/hash-partitioning-in-postgresql-11/ and reproduced steps from the, which gave exact same count outcome, which made me think hashing is a pure function. Examined the data I saw following distribution: dept_1: 1,14,39...; dept_2: 3,11,21...; dept_3: 16,18,25... I also found commit 1aba8e651a introducing the feature, but I'm not too much into internals. I wonder, could somebody write that hashing formula in pseudo-code or point to specific place in the code, please? Thanks, Vlad
Re: Partition by hash formula
От:
Laurenz Albe <laurenz.albe@cybertec.at>
Дата:
On Fri, 2020-03-20 at 12:50 +0300, Vlad Bokov wrote: > recently I read > https://blog.dbi-services.com/hash-partitioning-in-postgresql-11/ > and reproduced steps from the, which gave exact same count outcome, > which made me think > hashing is a pure function. > > Examined the data I saw following distribution: > dept_1: 1,14,39...; dept_2: 3,11,21...; dept_3: 16,18,25... > > I also found commit 1aba8e651a introducing the feature, but I'm not too > much into internals. > I wonder, could somebody write that hashing formula in pseudo-code or > point to specific place in the code, please? Look for the int4hashfast, texthashfast and similar functions in src/backend/utils/cache/catcache.c Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com