华为GaussDB 200创建索引出现ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes错误,跟华为售后沟通后,确认是没有加分布列造成的报错,具体过程如下:
testdb=> create unique index "rule_test_1" on "public"."test_1" using btree("xh");
ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes
testdb=>
testdb=> \d+ public.test_1
Table "public.test_1"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------------------------+-----------+----------+--------------+-------------
id | integer | not null | plain | |
xh | character varying(128) | | extended | |
Indexes:
"test_1_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
Has OIDs: no
Distribute By: HASH(id)
Location Nodes: ALL DATANODES
Options: orientation=row, compression=no
testdb=> create unique index "rule_test_1" on "public"."test_1" using btree("xh","id");
CREATE INDEX
testdb=> \d+ public.test_1
Table "public.test_1"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------------------------+-----------+----------+--------------+-------------
id | integer | not null | plain | |
xh | character varying(128) | | extended | |
Indexes:
"test_1_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
"rule_test_1" UNIQUE, btree (xh, id) TABLESPACE pg_default
Has OIDs: no
Distribute By: HASH(id)
Location Nodes: ALL DATANODES
Options: orientation=row, compression=no
testdb=> select * from test_1
testdb-> ;
id | xh
----+-----
2 | 1s
1 | 2s
(2 rows)
testdb=> insert into test_1 values(3,'dd');
INSERT 0 1
testdb=> insert into test_1 values(4,'dd');
INSERT 0 1
testdb=> insert into test_1 values(5,'dd');
INSERT 0 1
testdb=>
testdb=> select * from test_1;
id | xh
----+-----
1 | 2s
5 | dd
3 | dd
2 | 1s
4 | dd
5 | dd
(6 rows)
testdb=> create table tablename(id int,xh character(50)) DISTRIBUTE BY HASH(xh);
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。