Re: HASH partitioning not working properly

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: HASH partitioning not working properly
Дата
Msg-id 219b96f22844aa5408285ef7d4a049af56fb7915.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: HASH partitioning not working properly  (Srinivasa T N <seenutn@gmail.com>)
Список pgsql-general
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




В списке pgsql-general по дате отправления:

Предыдущее
От: Srinivasa T N
Дата:
Сообщение: Re: HASH partitioning not working properly
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Conflict with recovery on PG version 11.6