Re: Postgres 11, partitioning with a custom hash function

2018-10-04 Thread David Rowley
On 5 October 2018 at 09:43, Harry B wrote: > Now the big question: How scared should I be relying on this? I don't mind > it breaking on major version upgrades (which would mean I need to dump & > restore my entire set), but how likely is it to change unannounced in a > minor/security release? Unl

Re: Postgres 11, partitioning with a custom hash function

2018-10-04 Thread Harry B
Thanks for the quick response David! this has been really helpful. Looking at the code, this step wasn't totally unnecessary - if I had multi-column hash you would have had to do this step anyways - because pg hashes each column separately and combines them. True, unnecessary for single column has

Re: Postgres 11, partitioning with a custom hash function

2018-10-04 Thread David Rowley
On 5 October 2018 at 06:18, Harry B wrote: > > Thank you David! These helped me create an operator class. > However, there still seems to be a 'off-by-a-fixed-N' difference between the > hash value returned and how PG selects the partition. hmm, actually, this is probably due to the hash_combine6

Re: Postgres 11, partitioning with a custom hash function

2018-10-04 Thread Harry B
Thank you David! These helped me create an operator class. However, there still seems to be a 'off-by-a-fixed-N' difference between the hash value returned and how PG selects the partition. http://dpaste.com/381E6CF Am I overlooking some endianness difference!!?? For this setup, values are alway

Re: Postgres 11, partitioning with a custom hash function

2018-10-03 Thread David Rowley
On 4 October 2018 at 16:22, Harry B wrote: > I am still having trouble reconciling what happens under the HASH > partitioning!. If I have text column forming the basis of PARTITIONED BY > HASH, the HASH value used in the partitioning setup does not seem to match > to `hashtext()` of that value It

Re: Postgres 11, partitioning with a custom hash function

2018-10-03 Thread Harry B
Hi, I am still having trouble reconciling what happens under the HASH partitioning!. If I have text column forming the basis of PARTITIONED BY HASH, the HASH value used in the partitioning setup does not seem to match to `hashtext()` of that value CREATE TABLE loopy (k TEXT PRIMARY KEY, something

Re: Postgres 11, partitioning with a custom hash function

2018-10-03 Thread Harry B
Hi, Since I didn't hear back on how to make partitioning work using a custom hash function, I ended up changing my app/client to use postgres' built-in hash method instead - I just needed them to match. https://github.com/harikb/pghash https://github.com/harikb/pghash/blob/master/lib/pghash/pghas