greenplum数据导入导出

一、数据导入

greenplum数据导入有五种方式:

 

1. insert:通过sql直接插入数据

 

2. copy:通过master节点加载,无法实现并行高效数据加载

copy tablename from '/home/../test.cvs' with delimiter ',';

 

3. 外部表:

创建外部表,然后插入数据

 

4. gpload:外部表的封装

通过编辑gpload控制文件test.yml完成导入

gpload -f test.yml

 

5. 可执行外部表:不需要启动gpfdist服务

create external web table test1(..)

execute 'cat /home/../test.dat' on master

format 'text' (delimiter ',' null as '' escape 'off')

encoding '';

insert into test select * from test1;

 

数据导出:

1、copy命令导出

 

2、可写外部表导出数据:

create writable external table test1

(like test)

location ('gpfdist://localhost:8888/test.dat')

format 'text' (delimiter ',')

distribute by ..;

insert into test1 select * from test;

 

3、通过 pg_dump导出

pg_dump -f basicmod.sql -h hostname -U username -s -n schema_name db_name  # -s 代表只导出schema元信息,不包括数据

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值