Re: Postgres 11, partitioning with a custom hash function

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Postgres 11, partitioning with a custom hash function
Дата
Msg-id CAKJS1f-oj3_3HCs8KuyGL6kpm0GHLWjekT0Mzv_zWLipnsAKCg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Postgres 11, partitioning with a custom hash function  (Harry B <harrysungod@gmail.com>)
Ответы Re: Postgres 11, partitioning with a custom hash function  (Harry B <harrysungod@gmail.com>)
Список pgsql-general
On 4 October 2018 at 16:22, Harry B <harrysungod@gmail.com> 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 won't match. The hash partition hash is seeded with a special const
(HASH_PARTITION_SEED) see [1].

You could likely roll your own hash ops. See [2] for an example. This
can then be used to create a hash partitioned table like [3].

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/partitioning/partbounds.c#l2056
[2] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/test/regress/sql/insert.sql#l241
[3] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/test/regress/sql/hash_part.sql#l10

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Harry B
Дата:
Сообщение: Re: Postgres 11, partitioning with a custom hash function
Следующее
От: Satoshi Nagayasu
Дата:
Сообщение: Using RETURNING with INSERT TRIGGER on 9.6 partitioned table