Re: HASH partitioning not working properly - Mailing list pgsql-general

From Laurenz Albe
Subject Re: HASH partitioning not working properly
Date
Msg-id c8f81436ebf46f083b56af189093872f869f8cf1.camel@cybertec.at
Whole thread Raw
In response to Re: HASH partitioning not working properly  (Srinivasa T N <seenutn@gmail.com>)
Responses Re: HASH partitioning not working properly  (Srinivasa T N <seenutn@gmail.com>)
List pgsql-general
On Fri, 2020-06-19 at 12:12 +0530, Srinivasa T N wrote:
> On Fri, Jun 19, 2020 at 11:44 AM David Rowley <dgrowleyml@gmail.com> wrote:
> > On Fri, 19 Jun 2020 at 17:42, Srinivasa T N <seenutn@gmail.com> wrote:
> > >    After seeing the below, I feel partitioning is not working properly or it maybe case that my understanding is
wrong. Can somebody explain me what is happening?
 
> > 
> > It's your understanding that's not correct.  The value of is passed
> > through a hash function and the partition is selected based partition
> > matching the remainder value after dividing the return value of the
> > hash function by the largest modulus of any partition.
> > 
> > That might surprise you, but how would you select which partition a
> > varchar value should go into if you didn't use a hash function.
> > 
> > David
> 
> How can I see the output of hash function that is used internally?

In the case of "integer", the hash function is "pg_catalog"."hashint4".

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-general by date:

Previous
From: Srinivasa T N
Date:
Subject: Re: HASH partitioning not working properly
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: A query in Streaming Replication