HASH partitioning not working properly

Поиск
Список
Период
Сортировка
От Srinivasa T N
Тема HASH partitioning not working properly
Дата
Msg-id CAFruNddApLqb36oUVyHr1BhnN1he1yWUpzqgrT0gPYL_mufB4A@mail.gmail.com
обсуждение исходный текст
Ответы Re: HASH partitioning not working properly
Список pgsql-general
Hi,
   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?

postgres=# create table busbar_version (objectid int, ver_id int) partition by hash(ver_id);
CREATE TABLE
postgres=# CREATE TABLE busbar_version0 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 0);
CREATE TABLE
postgres=# CREATE TABLE busbar_version5 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 5);
CREATE TABLE
postgres=# CREATE TABLE busbar_version6 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 6);
CREATE TABLE
postgres=# CREATE TABLE busbar_version7 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 7);
CREATE TABLE

I did insert using following:

postgres=# insert into busbar_version(objectid,ver_id) values (5,5);
INSERT 0 1
postgres=# insert into busbar_version(objectid,ver_id) values (6,6);
INSERT 0 1

I was of the opinion that the above rows were inserted into busbar_version5 and busbar_version6, but I'm wrong.

postgres=# select * from busbar_version;
 objectid | ver_id
----------+--------
        5 |      5
        6 |      6
(2 rows)

postgres=# select * from busbar_version5;
 objectid | ver_id
----------+--------
        5 |      5
(1 row)

postgres=# select * from busbar_version6;
 objectid | ver_id
----------+--------
(0 rows)

postgres=# select * from busbar_version7;
 objectid | ver_id
----------+--------
        6 |      6
(1 row)

   Why second insert has gone to table busbar_version7 instead of busbar_version6?  

If it helps, I am trying on the "psql (12.3 (Debian 12.3-1.pgdg100+1))" container.

Regards,
Seenu.

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

Предыдущее
От: Paul Förster
Дата:
Сообщение: Re: Netapp SnapCenter
Следующее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: Conflict with recovery on PG version 11.6