ITPub博客

首页 > 数据库 > > greenplum(gp)的常用命令

greenplum(gp)的常用命令

作者:TTT1234 时间:2023-03-03 09:41:45 0 删除 编辑

下面列举一些gp数据库的常用命令,这只是其中的一部分

连接gp命令:  
psql -d 库名 -h ip地址 -p 端口号 -U 用户名;

gp 添加分区:
alter table 表名 add partition d20190611 values('20190611') ;

gp 添加字段:
alter table 表名 add column update_flag varchar(255);

gp 重命名:
alter table 表名 rename column old_column_name to new_column_name;

gp 删除字段:
ALTER TABLE 表名 DROP COLUMN rt_gather_price_remark;

gp 修改字段的类型:
alter table 表名 alter column rt_gather_price_remark varchar(200) text;

gp 删除表:
drop table if exists 表名;

gp 删除分区:
alter table 表名 DROP partition d20190729;

gp 清空分区数据:
alter table 表名 truncate partition d20191010;

gp 删除进程:
select pg_cancel_backend(407367);

gp 查看表结构:
SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a
.atttypmod AS lengthvar,a.attnotnull AS notnull from pg_class c,pg_attribute a,pg_type t where
c.relname='表名' and a.attnum> and a.attrelid=c.oid and a.atttypid=t.oid order by attnum ;



本文来源:https://blog.csdn.net/xianpanjia4616/article/details/102527711

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69953058/viewspace-3159142/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-11-13

  • 博文量
    566
  • 访问量
    5204