指定shard key 建表方式

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# create table t_appoint_col(id serial not null,nickname text) distribute by shard(nickname);
CREATE TABLE
postgres=# \d+ t_appoint_col
                                              Table "public.t_appoint_col"
  Column  |  Type   |                         Modifiers                          | Storage  | Stats target | Description 
----------+---------+------------------------------------------------------------+----------+--------------+-------------
 id       | integer | not null default nextval('t_appoint_col_id_seq'::regclass) | plain    |              | 
 nickname | text    |                                                            | extended |              | 
Has OIDs: no
Distribute By SHARD(nickname)
        Location Nodes: ALL DATANODES