云主机开年特惠28.8元/年,0元秒杀等你来抢!
查看详情

活动

天翼云最新优惠活动,涵盖免费试用,产品折扣等,助您降本增效!
热门活动
  • 安全隔离版OpenClaw NEW OpenClaw云服务器专属“龙虾“套餐低至1.5折起
  • 天翼云新春焕新季 NEW 云主机开年特惠28.8元/年,0元秒杀等你来抢!
  • 云上钜惠 爆款云主机全场特惠,2核4G只要1.8折起!
  • 中小企业服务商合作专区 国家云助力中小企业腾飞,高额上云补贴重磅上线
  • 出海产品促销专区 NEW 爆款云主机低至2折,高性价比,不限新老速来抢购!
  • 天翼云奖励推广计划 加入成为云推官,推荐新用户注册下单得现金奖励
免费活动
  • 免费试用中心 HOT 多款云产品免费试用,快来开启云上之旅
  • 天翼云用户体验官 NEW 您的洞察,重塑科技边界

息壤智算

领先开放的智算服务平台,提供算力、平台、数据、模型、应用“五位一体”智算服务体系,构建全流程的AI基础设施能力
AI Store
  • 算力市场
  • 模型市场
  • 应用市场
  • MCP市场
公共算力服务
  • 裸金属
  • 定制裸金属
训推服务
  • 模型开发
  • 训练任务
  • 服务部署
模型推理服务
  • 模型广场
  • 体验中心
  • 服务接入
应用托管
  • 应用实例
科研助手
  • 科研智能体
  • 科研服务
  • 开发机
  • 并行计算
大模型
  • DeepSeek-V3.1
  • DeepSeek-R1-0528
  • DeepSeek-V3-0324
  • Qwen3-235B-A22B
  • Qwen3-32B
智算一体机
  • 智算一体机
模型适配专家服务
  • 模型适配专家服务
算力服务商
  • 入驻算力服务商

应用商城

天翼云精选行业优秀合作伙伴及千余款商品,提供一站式云上应用服务
进入甄选商城进入云市场进入AI Store创新解决方案公有云生态专区智云上海应用生态专区
建站工具
  • 新域名服务
  • SSL证书
  • 翼建站
企业办公
  • 安全邮箱
  • WPS 365 天翼云版
  • 天翼企业云盘(标准服务版)
灾备迁移
  • 云管家2.0
  • 翼备份(SaaS版)

定价

协助您快速了解云产品计费模式、价格详情,轻松预估上云成本
价格计算器
  • 动态测算产品价格
定价策略
  • 快速了解计费模式

合作伙伴

天翼云携手合作伙伴,共创云上生态,合作共赢
天翼云生态合作中心
  • 天翼云生态合作中心
天翼云渠道合作伙伴
  • 天翼云代理渠道合作伙伴
天翼云服务合作伙伴
  • 天翼云集成商交付能力认证
天翼云应用合作伙伴
  • 天翼云云市场合作伙伴
  • 天翼云甄选商城合作伙伴
天翼云技术合作伙伴
  • 天翼云OpenAPI中心
天翼云培训认证
  • 天翼云学堂
  • 天翼云市场商学院
天翼云合作计划
  • 云汇计划
天翼信创云专区
  • 信创云专区
  • 适配互认证

开发者

开发者相关功能入口汇聚
技术社区
  • 专栏文章
  • 互动问答
  • 技术视频
资源与工具
  • OpenAPI中心
培训与认证
  • 天翼云学堂
  • 天翼云认证
开源社区
  • 魔乐社区
  • OpenTeleDB

支持与服务

为您提供全方位支持与服务,全流程技术保障,助您轻松上云,安全无忧
文档与工具
  • 文档中心
  • 新手上云
  • 自助服务
  • OpenAPI中心
定价
  • 价格计算器
  • 定价策略
基础服务
  • 售前咨询
  • 在线支持
  • 在线支持
  • 工单服务
  • 服务保障
  • 会员中心
增值服务
  • 红心服务
  • 首保服务
  • 客户支持计划
  • 专家技术服务
  • 备案管家
我要反馈
  • 建议与反馈
  • 用户体验官
信息公告
  • 客户公告

了解天翼云

天翼云秉承央企使命,致力于成为数字经济主力军,投身科技强国伟大事业,为用户提供安全、普惠云服务
品牌介绍
  • 关于天翼云
  • 智算云
  • 天翼云4.0
  • 新闻资讯
  • 天翼云APP
基础设施
  • 全球基础设施
  • 信任中心
最佳实践
  • 精选案例
  • 超级探访
  • 云杂志
  • 分析师和白皮书
  • 天翼云·创新直播间
市场活动
  • 2025智能云生态大会
  • 2024智算云生态大会
  • 2023云生态大会
  • 2022云生态大会
  • 天翼云中国行
天翼云
  • 活动
  • 息壤智算
  • 产品
  • 解决方案
  • 应用商城
  • 定价
  • 合作伙伴
  • 开发者
  • 支持与服务
  • 了解天翼云
      • 文档
      • 控制中心
      • 备案
      • 管理中心
      天翼云云物融合_相关内容
      • 变量使用介绍
        在一个块中使用的所有变量必须在该块的声明小节中事先进行声明,PL/pgSQL变量可以是任意SQL数据类型,可以是一个简单数据类型、复合类型、RECORD、已经存在的表行类型、表字段类型、游标。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        PL:pgsql开发
        变量使用
        变量使用介绍
      • 创建列存储表
        本页介绍如何创建、查看和删除列存储表。 创建列存储表 要创建列存储表,需要将表的访问方式(Table Access Method) 设为 PAX,在建表时显式使用 USING PAX 子句指定表访问方式 teledb CREATE TABLE t1(a int, b int, c text) USING PAX; CREATE TABLE teledb d+ t1 Table "public.t1" Column Type Collation Nullable Default Storage Stats target Description +++++++ a integer plain b integer plain c text extended Distribute By: HASH(a) Location Nodes: ALL DATANODES 查看列存储表访问方式 查询系统目录表pgclass 和 pgam 检查列存储表的访问方式 teledb SELECT relname, amname FROM pgclass, pgam WHERE relam pgam.oid AND relname 't1'; relname amname + t1 pax (1 row) 删除列存储表 删除列存储表和行存表语法一致,使用drop table 语句删除 teledb drop table t1; DROP TABLE
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        列存储引擎
        基础使用介绍
        创建列存储表
      • CDC
        CDC是一种用于捕获,处理和同步TeleDBX实例数据变化的工具,允许将实例中的变更数据实时地同步到下游系统。本页为您介绍CDC的使用和管理操作。 初始化插件 1. 通过pgxcctl新建一个双CN、双DN的实例,并开启服务。 2. 通过telesql连接到CN节点。 3. 在配置文件中设置加载sharedpreloadlibraries。 创建插件 1. 通过telesql连接到CN节点。 执行sql “create extension teledbxcdc” 2. 执行telesql命令dx,查看插件teledbxcdc是否存在。 3. 执行sql “select teledbxinitcdcmeta();”对元数据进行初始化。 管理cdc复制槽 1. 执行以下语法在所有数据节点创建逻辑复制槽 plaintext select from teledbxcreatelogicalreplicationslot('cdcdemo','teledbxcdc'); 2. 执行以下语法查看元数据 plaintext select from teledbx.cdcslot; 3. 执行以下语法删除逻辑复制槽 plaintext select from teledbxdroplogicalreplicationslot('cdcdemo'); 读取变更数据 1. 执行以下语法对变更数据进行可重复读,返回结果为text类型 plaintext select from teledbxcdcpeekchanges('slotname', batchcount, optionalvalue); 2. 执行以下语法对变更数据进行可重复读,返回结果为binary类型 plaintext select from teledbxcdcpeekbinarychanges('slotname', batchcount, optionalvalue); 3. 执行以下语法推高逻辑复制槽位点 plaintext teledb 4. 执行以下语法对变更数据进行不可重复读,返回结果为text类型 plaintext select from teledbxcdcgetchanges('slotname', batchcount, optionalvalue); 5. 执行以下语法对变更数据进行不可重复读 plaintext select from teledbxcdcgetbinarychanges('slotname', batchcount, optionalvalue);
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        CDC
      • 将带有依赖项表移出回收站
        本页为您介绍如何将带有依赖项表移出回收站。 plaintext ALTER TABLE trash.5 RENAME to t3; ALTER TABLE trash.t SET SCHEMA public; dt "trash". List of relations Schema Name Type Owner +++ trash 3 table teledb trash 4 table teledb trash trashtable table teledb (3 rows) d+ t3 Table "t3" Column Type Collation Nullable Default Storage Stats target Description +++++++ id integer not null plain Indexes: "5.1" btree (id) Distribute By: SHARD(id) Location Nodes: ALL DATANODES
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        闪回恢复
        将带有依赖项表移出回收站
      • 删除带有依赖项的表
        本页为您介绍如何删除带有依赖项的表。 plaintext view CREATE TABLE t1(id int); CREATE VIEW v1 AS SELECT FROM t1; DROP TABLE t1; ERROR: cannot drop table t1 because other objects depend on it DETAIL: view v1 depends on table t1 HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TABLE t1 CASCADE; NOTICE: drop cascades to view v1 dt "trash". List of relations Schema Name Type Owner +++ trash 3 table teledb trash trashtable table teledb (2 rows) dv "trash". List of relations Schema Name Type Owner +++ trash 3.1 view teledb (1 row) SELECT orgrelname, newrelname, orgnspname, relowner FROM trash.trashtable; orgrelname newrelname orgnspname relowner +++ test1 1 public teledb test2 2 public teledb t1 3 public teledb (3 rows) matview CREATE TABLE t2(id int); CREATE MATERIALIZED VIEW mv1 AS SELECT FROM t2; DROP TABLE t2; ERROR: cannot drop table t2 because other objects depend on it DETAIL: materialized view mv1 depends on table t2 HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TABLE t2 CASCADE; NOTICE: drop cascades to materialized view mv1 dt "trash". List of relations Schema Name Type Owner +++ trash 3 table teledb trash 4 table teledb trash trashtable table teledb (3 rows) dmv "trash". List of relations Schema Name Type Owner +++ trash 3.1 view teledb trash 4.1 materialized view teledb (2 rows) SELECT orgrelname, newrelname, orgnspname, relowner FROM trash.trashtable; orgrelname newrelname orgnspname relowner +++ test1 1 public teledb test2 2 public teledb t1 3 public teledb t2 4 public teledb (4 rows) index CREATE TABLE t3(id int); CREATE INDEX i1 ON t3(id); DROP TABLE t3; dt "trash". List of relations Schema Name Type Owner +++ trash 3 table teledb trash 4 table teledb trash 5 table teledb trash trashtable table teledb (4 rows) d+ "trash".5 Table "trash.5" Column Type Collation Nullable Default Storage Stats target Description +++++++ id integer not null plain Indexes: "5.1" btree (id) Distribute By: SHARD(id) Location Nodes: ALL DATANODES SELECT orgrelname, newrelname, orgnspname, relowner FROM trash.trashtable; orgrelname newrelname orgnspname relowner +++ test1 1 public teledb test2 2 public teledb t1 3 public teledb t2 4 public teledb t3 5 public teledb (5 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        闪回恢复
        删除带有依赖项的表
      • 查询记录所在 DN
        本文为您介绍使用SELECT语法查询记录所在的DN。 teledb select xcnodeid, from teledbpg1; xcnodeid id nickname ++ 1085152094 5 test 1085152094 6 teledb, teledb1 506537247 3 pg (3 rows) teledb select t1.xcnodeid, pgxcnode.nodename, t1. from teledbpg1 t1, pgxcnode where t1.xcnodeid pgxcnode.nodeid; xcnodeid nodename id nickname +++ 1085152094 dn01 5 test 1085152094 dn01 6 teledb, teledb1 506537247 dn02 3 pg (3 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DML操作
        SELECT语法
        查询记录所在 DN
      • 配置用户访问模式权限
        您可以参考本文,配置用户访问模式权限。 当普通用户访问某个模式下的对象时,需要对对象授权,也需要对模式授权。 [teledb@localhost bin]$ ./telesql p 11111 U teledb d teledb Password for user teledb: telesql (TeleDB V6) Type "help" for help. 创建schema teledb create schema test; CREATE SCHEMA 创建表 teledb create table test.t1(id int); CREATE TABLE 创建用户user1 teledb create role user1 with login password 'User@184'; CREATE ROLE 给用户user1授权表访问权限 teledb grant select on test.t1 to user1; GRANT 示例: 切换至普通用户user1,尝试访问test.t1表。由于没有授权test模式,仍然无法访问。 teledb c user1 Password for user user1: You are now connected to database "teledb" as user "user1". teledb> select from test.t1; ERROR: permission denied for schema test LINE 1: select from test.t1; ^ 切换至teledb用户,将test模式的访问权限授权给user1,重新用user1访问t1表。 teledb> c teledb Password for user teledb: You are now connected to database "teledb" as user "teledb". 授权schema teledb grant usage on schema test to user1; GRANT teledb c user1 Password for user user1: You are now connected to database "teledb" as user "user1". teledb> select from test.t1; id (0 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        模式管理
        配置用户访问模式权限
      • 修改表结构
        d t Table "public.t" Column Type Collation Nullable Default ++++ id integer not null mc text Indexes: "tpkey" PRIMARY KEY, btree (id) 添加外键 teledb create table tp(f1 int not null,f2 int ,primary key(f1)); CREATE TABLE teledb create table tf(f1 int not null,f2 int ); CREATE TABLE teledb ALTER TABLE tf ADD CONSTRAINT tff1fkey FOREIGN KEY (f1) REFERENCES tp (f1); ALTER TABLE teledb d+ tf Table "public.tf" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 integer not null plain f2 integer plain Foreignkey constraints: "tff1fkey" FOREIGN KEY (f1) REFERENCES tp(f1) Distribute By: SHARD(f1) Location Nodes: ALL DATANODES 外键使用限制: 外键只是同一个节点内约束有效果,所以外键字段和对应主键字段必需都是表的分布键,否则由于数据分布于不同的节点内会导致更新失败。 分区表和冷热分区表也不支持外键,数据分区后位于不同的物理文件中,无法约束。 删除外键 teledb ALTER TABLE tf DROP CONSTRAINT tff1fkey; ALTER TABL 修改表所属模式 teledb create schema teledb; CREATE SCHEMA teledb dt t List of relations Schema Name Type Owner +++ public t table teledb (1 row) teledb
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        修改表结构
      • 多字段索引
        explain select from tmulidx where f11 or f22 or f33 ; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn001, dn002 > Seq Scan on tmulidx (cost0.00..12966.87 rows3 width16) Filter: ((f1 1) OR (f2 2) OR (f3 3)) (4 rows) Time: 3.153 ms 如果返回字段全部在索引文件中,则只需要扫描索引,IO 开销会更少。 teledb explain select f1,f2,f3 from tmulidx where f11 ; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn01 > Index Only Scan using tmulidxidx on tmulidx (cost0.42..8.44 rows1 width12) Index Cond: (f1 1) (4 rows) Time: 2.630 ms 更新性能比单字段多索引文件要好。 多字段 teledb truncate table tmulidx; TRUNCATE TABLE Time: 44.930 ms teledb insert into tmulidx select t,t,t,t from generateseries(1,1000000) as t; INSERT 0 1000000 Time: 1985.901 ms (00:01.986) 单字段 teledb create table tsimpleidx (f1 int,f2 int,f3 int,f4 int); CREATE TABLE teledb create index tsimpleidxidx on tsimpleidx(f1); CREATE INDEX teledb create index tsimpleidxidx1 on tsimpleidx(f2); CREATE INDEX teledb create index tsimpleidxidx2 on tsimpleidx(f3); CREATE INDEX teledb insert into tsimpleidx select t,t,t,t from generateseries(1,1000000) as t; INSERT 0 1000000 Time: 4186.401 ms (00:04.186) 多字段索引走非第一字段查询时性能比独立的单字段差。 多字段 teledb
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        多字段索引
      • gist 索引
        本文为您介绍如何使用gist 索引。 注意 此功能需加载插件 pgtrgm。 teledb create extension pgtrgm; CREATE EXTENSION teledb create table ttrgm (id int,trgm text,notrgm text) ; ERROR: relation "ttrgm" already exists teledb create index ttrgmtrgmidx on ttrgm using gist(trgm gisttrgmops); CREATE INDEX
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        gist 索引
      • 索引优化建议
        字段名称 说明 dbid SQL 操作的数据库 queryid SQL 语句 ID query SQL 语句内容 sourcenode 索引建议生效的节点 recmndedindex 针对该SQL 的索引建议 costwithoutindex 不采用索引建议时的执行代价 costwithindex 采用索引建议时的执行代价 percentimproved 索引建议提高的执行性能(百分比%) currentplan 原SQL 语句的查询计划 hypoplan 使用索引建议后SQL 语句的查询计划 iscreated 该索引是否已经被创建
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        索引优化建议
      • any 用法
        本文介绍如何在使用SELECT语法时添加any条件。 只需要大于其中一个值即为真。 teledb select from teledbpg where id > any (select 1 union select 3); id nickname + 3 pg 4 2 TELEDB (3 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DML操作
        SELECT语法
        any 用法
      • 数据排序
        本文为您介绍如何在使用SELECT语法时进行排序。 按某一列排序 teledb create table teledbpg(id int, nickname text); CREATE TABLE teledb insert into teledbpg values(1,'teledb'),(3,'pg'),(1,'hello,pgxc'); COPY 3 teledb select from teledbpg order by nickname; id nickname + 1 hello,pgxc 3 pg 1 teledb (3 rows) 按第一列排序 teledb select from teledbpg order by 1; id nickname + 1 teledb 1 hello,pgxc 3 pg 按ID 升级排序,再按 nickname 降序排序 teledb select from teledbpg order by id,nickname desc; id nickname + 1 teledb 1 hello,pgxc 3 pg (3 rows) 效果与上面的语句一样。 teledb select from teledbpg order by 1,2 desc; id nickname + 1 teledb 1 hello,pgxc 3 pg (3 rows) 随机排序 teledb select from teledbpg order by random(); id nickname + 1 teledb 3 pg 1 hello,pgxc (3 rows) teledb select from teledbpg order by random(); id nickname + 1 hello,pgxc 1 teledb 3 pg (3 rows) 计算排序 teledb select from teledbpg order by md5(nickname); id nickname + 1 hello,pgxc 3 pg 1 teledb (3 rows) 排序也能用子查询。 teledb
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DML操作
        SELECT语法
        数据排序
      • copy使用
        使用delimiter指定列与列之间的分隔符 teledb copy t to '/home/teledb/t.txt' with delimiter '@'; COPY 3 teledb ! cat /home/teledb/t.txt 1@张三@20001201 00:00:00@北京 2@李四@19970324 00:00:00@上海 3@王五@20040901 00:00:00@广州 teledb copy t to '/home/teledb/t.txt' with csv delimiter '@'; COPY 3 teledb ! cat /home/teledb/t.txt 1@张三@20001201 00:00:00@北京 2@李四@19970324 00:00:00@上海 3@王五@20040901 00:00:00@广州 teledb copy t to '/home/teledb/t.txt' with csv delimiter '@@'; ERROR: COPY delimiter must be a single onebyte character teledb copy t to '/home/teledb/t.txt' with binary delimiter '@'; ERROR: cannot specify DELIMITER in BINARY mode 指定分隔文件各列的字符。文本格式中默认是一个制表符, 而CSV格式中默认是一个逗号。分隔符必须是一个单一的单字节字符,即汉字是不支持的。使用binary格式时不允许这个选项。 NULL 值的处理 teledb insert into t(name, birth, city) values('赵六','20001201', null); INSERT 0 1 teledb copy t to '/home/teledb/t.txt' with csv null 'NULL'; COPY 4 teledb ! cat /home/teledb/t.txt 1,张三,20001201 00:00:00,北京 2,李四,19970324 00:00:00,上海 3,王五,20040901 00:00:00,广州 4,赵六,20001201 00:00:00,NULL 记录值为NULL时导出为NULL字符。使用binary格式时不允许这个选项。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        copy使用
      • 存储组管理
        drop node group defaultgroup; DROP NODE GROUP 修改存储组 修改存储组只能将存储组定义为默认存储组,语法如下: alter node group groupname set to default; 当已存在默认存储组的情况下,此语句无法生效。 teledb create node group group1 with (dn01); CREATE NODE GROUP teledb create node group group2 with (dn02); CREATE NODE GROUP teledb alter node group group1 set to default; ALTER NODE GROUP teledb alter node group group2 set to default; ERROR: default group already exists, groupoid:57352 查看存储组相关信息 teledb select oid, from pgxcgroup; oid groupname defaultgroup groupmembers +++ 57353 group2 0 16386 57352 group1 1 16385
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        存储组管理
      • 创建分区表
        本文为您介绍如何创建分区表。 创建范围分区表 teledb create table trange (f1 bigint,f2 timestamp default now(), f3 integer) partition by range (f3) begin (1) step (50) partitions (3) distribute by shard(f1); CREATE TABLE teledb insert into trange(f1,f3) values(1,1),(2,50),(3,100),(2,110); COPY 4 teledb insert into trange(f1,f3) values(1,1),(2,50),(3,100),(2,110); COPY 4 teledb d+ trange; Table "public.trange" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 bigint plain f2 timestamp without time zone now() plain f3 integer plain Distribute By: SHARD(f1) Location Nodes: ALL DATANODES Partition By: RANGE(f3) Of Partitions: 3 Start With: 1 Interval Of Partition: 50 创建时间范围分区表 teledb create table ttimerange (f1 bigint, f2 timestamp ,f3 bigint) partition by range (f2) begin (timestamp without time zone '20170901 0:0:0') step (interval '1 month') partitions (12) distribute by shard(f1); CREATE TABLE teledb d+ ttimerange Table "public.ttimerange" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 bigint plain f2 timestamp without time zone plain f3 bigint plain Distribute By: SHARD(f1) Location Nodes: ALL DATANODES Partition By: RANGE(f2)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据表管理
        创建分区表
      • 修改数据库配置
        项目 备注 encoding 编码 lccollate 排序规则 lcctype 分组规则
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据库管理
        修改数据库配置
      • 分页查询
        本文为您介绍如何在使用SELECT语法时进行分页查询。 默认从第一条开始,返回一条记录。 teledb select from teledbpg limit 1; id nickname + 1 teledb (1 row) 使用offset指定从第几条开始,0表示第一条开始,返回1条记录。 teledb select from teledbpg limit 1 offset 0; id nickname + 1 teledb (1 row) 从第3条开始,返回二条记录。 teledb select from teledbpg limit 2 offset 2; id nickname + 2 TELEDB 3 pg (2 rows) 上面的语句没有使用排序,返回结果不可预知,使用order by 可以获得一个有序的结果。 teledb select from teledbpg order by nickname; id nickname + 1 hello,pgxc 3 pg 1 teledb 2 TELEDB 4 (5 rows) teledb select from teledbpg order by nickname limit 2 offset 2; id nickname + 1 teledb 2 TELEDB (2 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DML操作
        SELECT语法
        分页查询
      • 访问函数
        本文为您介绍如何通过SELECT语法访问函数。 teledb select md5(random()::text); md5 ed5b356234979a63efc6c4f6537c4853 (1 row)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DML操作
        SELECT语法
        访问函数
      • TRUNCATE操作
        select from ttimerange; f1 f2 f3 ++ 1 20171001 00:00:00 100 1 20171101 00:00:00 100 (2 rows) truncate 一个数字分区表。 teledb select from trange; f1 f2 f3 ++ 1 20230823 10:29:46.263768 1 2 20230823 10:29:46.263768 50 2 20230823 10:29:46.263768 110 3 20230823 10:29:46.263768 100 (4 rows) teledb d+ trange Table "public.trange" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 bigint plain f2 timestamp without time zone now() plain f3 integer plain Distribute By: SHARD(f1) Location Nodes: ALL DATANODES Partition By: RANGE(f3) Of Partitions: 3 Start With: 1 Interval Of Partition: 50 teledb truncate trange partition for (1); TRUNCATE TABLE teledb truncate trange partition for (2); TRUNCATE TABLE teledb select from trange; f1 f2 f3 ++ 2 20230823 10:29:46.263768 110 3 20230823 10:29:46.263768 100 (2 rows)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        TRUNCATE操作
      • 删除索引
        本文为您介绍如何删除索引。 teledb drop index tmulidxidx; DROP INDEX
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        删除索引
      • 条件索引
        本文为您介绍如何使用条件索引。 teledb create table tsex(id int,sex text) ; CREATE TABLE teledb teledb create index tsexsexidx on tsex (sex); CREATE INDEX teledb insert into tsex select t,'男' from generateseries(1,1000000) as t; INSERT 0 1000000 teledb insert into tsex select t,'女' from generateseries(1,100) as t; INSERT 0 100 teledb analyze tsex ; ANALYZE teledb explain select from tsex where sex '女'; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn01, dn02 > Index Scan using tsexsexidx on tsex (cost0.42..9.30 rows50 width8) Index Cond: (sex '女'::text) (4 rows) 索引对于条件在性别为男的情况下无效。 teledb explain select from tsex where sex '男'; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn01, dn02 > Seq Scan on tsex (cost0.00..9966.58 rows500556 width8) Filter: (sex '男'::text) (4 rows) 连接DN 节点查看索引占用空间大,而且度数也高。 teledb di+ tsexsexidx List of relations Schema Name Type Owner Table Size Allocated Size Description +++++++ public tsexsexidx index teledb tsex 14 MB 14 MB (1 row) teledb q [teledb@localhost bin]$ ./telesql p 11111 U teledb d teledb Password for user teledb: telesql (TeleDB V6) Type "help" for help. teledb
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        条件索引
      • 添加分区子表
        本文为您介绍如何添加分区子表。 teledb d+ trange Table "public.trange" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 bigint plain f2 timestamp without time zone now() plain f3 integer plain Distribute By: SHARD(f1) Location Nodes: ALL DATANODES Partition By: RANGE(f3) Of Partitions: 3 Start With: 1 Interval Of Partition: 50 teledb alter table trange add partitions 2; ALTER TABLE teledb d+ trange Table "public.trange" Column Type Collation Nullable Default Storage Stats target Description +++++++ f1 bigint plain f2 timestamp without time zone now() plain f3 integer plain Distribute By: SHARD(f1) Location Nodes: ALL DATANODES Partition By: RANGE(f3) Of Partitions: 5 Start With: 1 Interval Of Partition: 50
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据表管理
        添加分区子表
      • 普通索引
        本文为您介绍如何管理普通索引。 teledb create index tididx on t1 using btree(id); CREATE INDEX
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        索引管理
        普通索引
      • 使用将查询结果创建数据表
        本文为您介绍如何使用查询结果创建数据表。 teledb insert into t values(1,'teledb'); INSERT 0 1 teledb create table tas as select from t; INSERT 0 1 teledb select from tas; id mc + 1 teledb (1 row)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据表管理
        使用将查询结果创建数据表
      • 指定模式创建表
        本文为您介绍如何指定模式创建表。 teledb create table public.t1(id int,mc text); CREATE TABLE
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据表管理
        指定模式创建表
      • 创建shard表
        本文为您介绍如何创建shard表。 不指定shard key 建表方式 不指定shard key 建表方法,系统默认使用第一个字段作为表的 shard key。 teledb create table test(id int, name varchar, birth date); CREATE TABLE teledb d+ test Table "public.test" Column Type Collation Nullable Default Storage Stats target Description +++++++ id integer plain name character varying extended birth timestamp(0) without time zone plain Distribute By: SHARD(id) Location Nodes: ALL DATANODES 分布键选择原则: 分布键只能选择一个字段。 如果有主键,则选择主键做分布键。 如果主键是复合字段组合,则选择字段值选择性多的字段做分布键。 也可以把复合字段拼接成一个新的字段来做分布键。 没有主键的可以使用UUID 来做分布键。 总之一定要让数据尽可能的分布得足够散。 指定shard key 建表方式 teledb create table testshard(id serial not null, name text) distribute by shard(name) to group defaultgroup; CREATE TABLE teledb d+ testshard Table "public.testshard" Column Type Collation Nullable Default Storage Stats target Description +++++++ id integer not null nextval('testshardidseq'::regclass) plain name text extended Distribute By: SHARD(name) Location Nodes: ALL DATANODES distribute by shard(x) 用于指定分布键,数据分布于那个节点就是根据这个字段值来计算分片。 to group xxx 用于指定存储组(每个存储组可以有多个节点)。 分布键字段值不能修改,字段长度不能修改,字段类型不能修改。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据表管理
        创建shard表
      • 创建数据库
        d dbgbk Did not find any relation named "dbgbk". teledb l+ dbgbk List of databases Name Owner Encoding Collate Ctype Access privileges Size Tablespace Description ++++++++ dbgbk teledb GBK zhCN.gbk zhCN.gbk 19 MB pgdefault (1 row) 指定排序规则 teledb create database teledbdblccollate lccollate 'C' template template0; CREATE DATABASE 指定分组规则 teledb create database teledblcctype LCCTYPE 'C' template template0; CREATE DATABASE 配置数据可连接 teledb create database teledballowconnections ALLOWCONNECTIONS true; CREATE DATABASE teledb select datallowconn from pgdatabase where datname 'teledballowconnections'; datallowconn t (1 row) teledb c teledballowconnections You are now connected to database "teledballowconnections" as user "teledb". 配置连接数 teledb create database teledbconnlimit CONNECTION LIMIT 100; CREATE DATABASE teledb select datconnlimit from pgdatabase where datname'teledbconnlimit'; datconnlimit 100 (1 row) 配置数据库可以被复制(是否模板数据库) teledb create database teledbistemplate istemplate true; CREATE DATABASE teledb select datconnlimit from pgdatabase where datname'teledbconnlimit'; datconnlimit 100 (1 row) 同时配置多个参数 teledb create database teledbmul owner teledbuser CONNECTION LIMIT 50 template template0 encoding 'utf8' lccollate 'C'; CREATE DATABASE
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        数据库管理
        创建数据库
      • 创建模式
        本文为您介绍如何创建模式。 您可参考如下操作创建模式。 标准语法 teledb create schema teledbschema; CREATE SCHEMA 注意 当标准语法不存在时,才创建扩展语法。 扩展语法 teledb create schema if not exists teledbschema; NOTICE: schema "teledbschema" already exists, skipping CREATE SCHEMA 指定所属用户 teledb create schema teledbschemaowner AUTHORIZATION teledbuser; CREATE SCHEMA teledb dn teledbschemaowner List of schemas Name Owner + teledbschemaowner teledbuser (1 row)
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        开发手册
        数据库基础开发
        DDL操作
        模式管理
        创建模式
      • 创建的目录、文件权限不足
        本文为您介绍创建的目录、文件权限不足的问题现象、问题原因和解决方案。 问题现象 手动执行如下命令,出现如下报错日志。 ssh p 22 o ConnectTimeout10 o StrictHostKeyCheckingno teledb@10.218.14.144 sudo yum y install dos2unix expect readline createrepo nettools lsof uuid 经过排查发现目录文件权限不对,用户组不具备读写操作权限。 原因分析 执行umask命令,发现其设置的值与实际不相符,查找出位0027,实际上位022才对,导致用户创建的文件或者目录用户组权限不对。 解决方案 方式一 1. 执行如下命令,给解压出的安装包赋予读写执行权限。 cd /app sudo chmod R 755 teledbxv2.8.6centos.x8664 sudo chown R teledb:teledb teledbxv2.8.6centos.x8664 ssh p 22 o ConnectTimeout10 o StrictHostKeyCheckingno teledb@10.218.14.144 sudo yum y install dos2unix expect readline createrepo nettools lsof uuid 2. 重新install,当出现如下回显信息表示安装成功。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        安装部署
        常见问题
        创建的目录、文件权限不足
      • 分布式存储架构及可扩展性
        相比于传统的集中式数据库,分布式数据被分散存储在多个物理位置(多台服务器或数据中心)上,并将这些分散的存储资源构成一个虚拟的存储设备。这种存储方式不仅实现在线扩容能力,同时也提升了数据的检索能力。而且分布式数据库利用SQL语言进行分布式查询和处理,使其性能和扩展性得到显著提升。 分布式数据存储原理 分布式存储架构通常由三个部分组成:客户端、元数据服务器(协调节点)和数据服务器(数据节点)。其主要流程是:客户端负责发送读写请求,缓存文件元数据和文件数据。元数据服务器(协调节点)管理元数据和处理客户端的请求。数据服务器(数据节点)存放文件数据,保证数据的可用性和完整性。分布式存储主要通过以下几种方式实现: 数据分片‌:在分布式存储系统中,数据被分成多个部分,每个部分存储在不同的数据节点上,以实现数据的分布式存储和管理。这种分片通常使用哈希函数或一致性哈希算法来实现。 主备复制‌:为了提高数据的可靠性和可用性,分布式存储系统通常分为主备节点。每个数据都存储在不同的数据节点上,以确保即使某些节点出现故障,仍然可以从其他节点中恢复数据。 数据一致性‌:确保数据在不同节点之间的一致性是分布式存储系统的关键。为了实现数据同步和管理,分布式存储系统使用数据同步和管理机制,如Paxos算法、Raft算法或ZooKeeper等分布式协调服务。 数据访问‌:在分布式存储系统中,数据可以并行地从多个节点中读取和写入,以提高读写性能和吞吐量。数据访问使用负载均衡机制实现,如分布式哈希表、分布式缓存或分布式文件系统等技术。 通过这种存储方式可实现TeleDB在线扩容能力,在业务无感知的情况下,在线弹性伸缩,提升系统容量和处理能力,以便满足大规模存储应用的需求。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        技术白皮书
        产品核心功能
        分布式存储架构及可扩展性
      • 创建实例开通时,不能添加主机
        本文为您介绍创建实例开通时,不能添加主机的问题现象、原因和解决方案。 问题现象 实例开通时,不能添加主机。 原因分析 DCP控制台不能纳管主机。9083端口未放通。 解决方案 添加安全组,放通端口,即可创建开通实例。
        来自:
        帮助文档
        分布式融合数据库HTAP
        私有云产品
        安装部署
        常见问题
        创建实例开通时,不能添加主机
      • 1
      • ...
      • 250
      • 251
      • 252
      • 253
      • 254
      • ...
      • 273
      跳转至
      推荐热词
      天翼云运维管理审计系统天翼云云服务平台云服务备份云日志服务应用运维管理云手机云电脑天翼云云hbase数据库电信云大数据saas服务电信云大数据paas服务轻量型云主机天翼云客户服务电话应用编排服务天翼云云安全解决方案云服务总线CSB天翼云服务器配置天翼云联邦学习产品天翼云云安全天翼云企业上云解决方案天翼云产品天翼云视频云存储

      天翼云最新活动

      安全隔离版OpenClaw

      OpenClaw云服务器专属“龙虾“套餐低至1.5折起

      天翼云新春焕新季

      云主机开年特惠28.8元/年,0元秒杀等你来抢!

      云上钜惠

      爆款云主机全场特惠,2核4G只要1.8折起!

      中小企业服务商合作专区

      国家云助力中小企业腾飞,高额上云补贴重磅上线

      出海产品促销专区

      爆款云主机低至2折,高性价比,不限新老速来抢购!

      天翼云奖励推广计划

      加入成为云推官,推荐新用户注册下单得现金奖励

      产品推荐

      多活容灾服务

      GPU云主机

      镜像服务 IMS

      天翼云CTyunOS系统

      训推服务

      AI Store

      科研助手

      人脸检测

      人脸实名认证

      推荐文档

      修改用户

      文档下载

      云服务器 ECS 购买须知

      产品类

      • 7*24小时售后
      • 无忧退款
      • 免费备案
      • 专家服务
      售前咨询热线
      400-810-9889转1
      关注天翼云
      • 旗舰店
      • 天翼云APP
      • 天翼云微信公众号
      服务与支持
      • 备案中心
      • 售前咨询
      • 智能客服
      • 自助服务
      • 工单管理
      • 客户公告
      • 涉诈举报
      账户管理
      • 管理中心
      • 订单管理
      • 余额管理
      • 发票管理
      • 充值汇款
      • 续费管理
      快速入口
      • 天翼云旗舰店
      • 文档中心
      • 最新活动
      • 免费试用
      • 信任中心
      • 天翼云学堂
      云网生态
      • 甄选商城
      • 渠道合作
      • 云市场合作
      了解天翼云
      • 关于天翼云
      • 天翼云APP
      • 服务案例
      • 新闻资讯
      • 联系我们
      热门产品
      • 云电脑
      • 弹性云主机
      • 云电脑政企版
      • 天翼云手机
      • 云数据库
      • 对象存储
      • 云硬盘
      • Web应用防火墙
      • 服务器安全卫士
      • CDN加速
      热门推荐
      • 云服务备份
      • 边缘安全加速平台
      • 全站加速
      • 安全加速
      • 云服务器
      • 云主机
      • 智能边缘云
      • 应用编排服务
      • 微服务引擎
      • 共享流量包
      更多推荐
      • web应用防火墙
      • 密钥管理
      • 等保咨询
      • 安全专区
      • 应用运维管理
      • 云日志服务
      • 文档数据库服务
      • 云搜索服务
      • 数据湖探索
      • 数据仓库服务
      友情链接
      • 中国电信集团
      • 天翼云国际站
      • 189邮箱
      • 天翼企业云盘
      • 天翼云盘
      ©2026 天翼云科技有限公司版权所有 增值电信业务经营许可证A2.B1.B2-20090001
      公司地址:北京市东城区青龙胡同甲1号、3号2幢2层205-32室
      • 用户协议
      • 隐私政策
      • 个人信息保护
      • 法律声明
      备案 京公网安备11010802043424号 京ICP备 2021034386号