复制表
 
                  更新时间 2025-02-05 09:36:26
                 
 
                    最近更新时间: 2025-02-05 09:36:26
                  
 本页介绍天翼云TeleDB数据库的复制表功能。
 复制表是所有DN 节点都存储一份相同的数据。
teledb=# create table t_rep (id int,mc text) distribute by replication;
CREATE TABLE
teledb=# \d+ t_rep 
                                   Table "public.t_rep"
 Column |  Type   | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+---------+-----------+----------+---------+----------+--------------+-------------
 id     | integer |           |          |         | plain    |              | 
 mc     | text    |           |          |         | extended |              | 
Distribute By: REPLICATION
Location Nodes: ALL DATANODES
所有节点都会保存一份数据。
teledb=#  insert into t_rep values(1,'teledb'),(2,'ctyun');
\COPY 2
teledb=# EXECUTE DIRECT ON (dn01) 'select * from t_rep';
 id |   mc  
----+---------
  1 | teledb
  2 | ctyun
(2 rows)
teledb=# EXECUTE DIRECT ON (dn02) 'select * from t_rep';
 id |   mc  
----+---------
  1 | teledb
  2 | ctyun
(2 rows)
