On Fri, 2020-06-19 at 13:27 +0530, Srinivasa T N wrote:
> > > 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".
>
> I guess output formatting is wrong, any help?
>
> postgres=# select pg_catalog.hashint4(7);
> hashint4
> ------------
> -978793473
> (1 row)
No, that is fine.
Just take the result mod 10 if that is how hash partitioning was defined:
select pg_catalog.hashint4(7) - floor(pg_catalog.hashint4(7) / 10.0) * 10;
?column?
----------
7
(1 row)
So that should end up in the eighth partition.
You have no choice which hash function to use for partitioning.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com