Re: HASH partitioning not working properly

From: Srinivasa T N <seenutn(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: HASH partitioning not working properly
Date: 2020-06-19 07:57:36
Message-ID: CAFruNdcAJGHM4gnh3kEzBS-dJT1PEzQoSYep7wMwMQc97KxPkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 19, 2020 at 12:34 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> 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(at)gmail(dot)com>
> wrote:
> > > On Fri, 19 Jun 2020 at 17:42, Srinivasa T N <seenutn(at)gmail(dot)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
>
> I guess output formatting is wrong, any help?

postgres=# select pg_catalog.hashint4(7);
hashint4
------------
-978793473
(1 row)

Regards,
Seenu.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Toomas Kristin 2020-06-19 08:46:53 Re: Conflict with recovery on PG version 11.6
Previous Message Kyotaro Horiguchi 2020-06-19 07:35:59 Re: A query in Streaming Replication