目录
文档用途
详细信息

文档用途
本文档主要用于展示瀚高数据库并行导入导出步骤和注意事项。

详细信息
1 创建测试环境

1.1 创建测试库

create database htest ;
1.2 创建测试表

htest=# create table bxtest (a integer,b integer,c integer ,d integer);

CREATE TABLE

1.3创建虚拟数据

htest=# insert into bxtest select (random()(105))::integer,(random()*(105))::integer,(random()(10^5))::integer from generate_series(1,1000000) ;

INSERT 0 1000000

注意:该出可以根据实际情况多执行几次,小批量数据在固态硬盘环境并行导出效果可能并不明显,每1000000条数据约42.5MB。

2 并行导出

2.1导出命令

mkdir /home/highgo/baktest

pg_dump -j 5 -f /home/highgo/baktest/test1 -d htest -F d -h localhost -p 5866 -U htest --导出htest库

pg_dump -j 5 -f /home/highgo/baktest/test2 -d htest -t bxtest -F d -h localhost -p 5866 -U htest --导出htest库中的bxtest表

2.1 进程展示

并行导出前:

[highgo@tqz baktest]$ ps -ef | grep postgres

highgo 1876 1 0 15:28 pts/1 00:00:00 /data/highgo/4.7.7/bin/postgres

highgo 1877 1876 0 15:28 ? 00:00:00 postgres: logger process

highgo 1879 1876 0 15:28 ? 00:00:00 postgres: checkpointer process

highgo 1880 1876 0 15:28 ? 00:00:00 postgres: writer process

highgo 1881 1876 0 15:28 ? 00:00:00 postgres: wal writer process

highgo 1882 1876 0 15:28 ? 00:00:00 postgres: autovacuum launcher process

highgo 1883 1876 0 15:28 ? 00:00:00 postgres: archiver process last was 000000010000000000000077

highgo 1884 1876 0 15:28 ? 00:00:00 postgres: stats collector process

highgo 4347 1876 1 18:19 ? 00:00:11 postgres: htest htest [local] idle

2.2 并行导出数据库状态

[highgo@tqz baktest]$ ps -ef | grep postgres

highgo 1876 1 0 15:28 pts/1 00:00:00 /data/highgo/4.7.7/bin/postgres

highgo 1877 1876 0 15:28 ? 00:00:00 postgres: logger process

highgo 1879 1876 0 15:28 ? 00:00:00 postgres: checkpointer process

highgo 1880 1876 0 15:28 ? 00:00:00 postgres: writer process

highgo 1881 1876 0 15:28 ? 00:00:00 postgres: wal writer process

highgo 1882 1876 0 15:28 ? 00:00:00 postgres: autovacuum launcher process

highgo 1883 1876 0 15:28 ? 00:00:00 postgres: archiver process last was 000000010000000000000077

highgo 1884 1876 0 15:28 ? 00:00:00 postgres: stats collector process

highgo 4347 1876 1 18:19 ? 00:00:11 postgres: htest htest [local] idle

highgo 4746 1876 7 18:32 ? 00:00:00 postgres: htest htest localhost(43298) idle in transaction

highgo 4752 1876 0 18:32 ? 00:00:00 postgres: htest htest localhost(43300) idle in transaction

highgo 4753 1876 0 18:32 ? 00:00:00 postgres: htest htest localhost(43302) idle in transaction

highgo 4754 1876 39 18:32 ? 00:00:00 postgres: htest htest localhost(43304) COPY

highgo 4755 1876 0 18:32 ? 00:00:00 postgres: htest htest localhost(43306) idle in transaction

highgo 4756 1876 0 18:32 ? 00:00:00 postgres: htest htest localhost(43308) idle in transaction

2.3 并行导出数据库中表状态

[highgo@tqz baktest]$ ps -ef | grep postgres

highgo 1876 1 0 15:28 pts/1 00:00:00 /data/highgo/4.7.7/bin/postgres

highgo 1877 1876 0 15:28 ? 00:00:00 postgres: logger process

highgo 1879 1876 0 15:28 ? 00:00:00 postgres: checkpointer process

highgo 1880 1876 0 15:28 ? 00:00:00 postgres: writer process

highgo 1881 1876 0 15:28 ? 00:00:00 postgres: wal writer process

highgo 1882 1876 0 15:28 ? 00:00:00 postgres: autovacuum launcher process

highgo 1883 1876 0 15:28 ? 00:00:00 postgres: archiver process last was 000000010000000000000077

highgo 1884 1876 0 15:28 ? 00:00:00 postgres: stats collector process

highgo 4347 1876 1 18:19 ? 00:00:11 postgres: htest htest [local] idle

highgo 4794 1876 1 18:34 ? 00:00:00 postgres: htest htest localhost(43316) idle in transaction

highgo 4800 1876 0 18:34 ? 00:00:00 postgres: htest htest localhost(43318) idle in transaction

highgo 4801 1876 0 18:34 ? 00:00:00 postgres: htest htest localhost(43320) idle in transaction

highgo 4802 1876 0 18:34 ? 00:00:00 postgres: htest htest localhost(43322) idle in transaction

highgo 4803 1876 26 18:34 ? 00:00:02 postgres: htest htest localhost(43324) COPY

highgo 4804 1876 0 18:34 ? 00:00:00 postgres: htest htest localhost(43326) idle in transaction

2.4 并行导出后状态

[highgo@tqz baktest]$ ps -ef | grep postgres

highgo 1876 1 0 15:28 pts/1 00:00:00 /data/highgo/4.7.7/bin/postgres

highgo 1877 1876 0 15:28 ? 00:00:00 postgres: logger process

highgo 1879 1876 0 15:28 ? 00:00:00 postgres: checkpointer process

highgo 1880 1876 0 15:28 ? 00:00:00 postgres: writer process

highgo 1881 1876 0 15:28 ? 00:00:00 postgres: wal writer process

highgo 1882 1876 0 15:28 ? 00:00:00 postgres: autovacuum launcher process

highgo 1883 1876 0 15:28 ? 00:00:00 postgres: archiver process last was 000000010000000000000077

highgo 1884 1876 0 15:28 ? 00:00:00 postgres: stats collector process

highgo 4347 1876 1 18:19 ? 00:00:11 postgres: htest htest [local] idle

2.5 导出后的文件

[highgo@tqz baktest]$ ll test1

total 26660

-rw-rw-r–. 1 highgo highgo 72 Jun 29 18:32 3584.dat.gz

-rw-rw-r–. 1 highgo highgo 78 Jun 29 18:32 3585.dat.gz

-rw-rw-r–. 1 highgo highgo 31 Jun 29 18:32 3586.dat.gz

-rw-rw-r–. 1 highgo highgo 32 Jun 29 18:32 3587.dat.gz

-rw-rw-r–. 1 highgo highgo 32 Jun 29 18:32 3588.dat.gz

-rw-rw-r–. 1 highgo highgo 27269433 Jun 29 18:32 3589.dat.gz

-rw-rw-r–. 1 highgo highgo 4953 Jun 29 18:32 toc.dat

[highgo@tqz baktest]$ ll test2

total 26636

-rw-rw-r–. 1 highgo highgo 27269433 Jun 29 18:34 3578.dat.gz

-rw-rw-r–. 1 highgo highgo 973 Jun 29 18:34 toc.dat

3 并行导入

3.1 创建数据库

create database htest_c;

3.2 使用超级用户关闭autovacuum,加速导入(可选)

alter system set autovacuum=off;

select pg_reload_conf();

3.3 导入数据

pg_restore -d htest_c -F d -j 5 -h localhost -p 5866 -U htest /home/highgo/baktest/test1

[highgo@tqz baktest]$ ps -ef | grep postgres

highgo 1876 1 0 15:28 pts/1 00:00:00 /data/highgo/4.7.7/bin/postgres

highgo 1877 1876 0 15:28 ? 00:00:00 postgres: logger process

highgo 1879 1876 0 15:28 ? 00:00:00 postgres: checkpointer process

highgo 1880 1876 0 15:28 ? 00:00:00 postgres: writer process

highgo 1881 1876 0 15:28 ? 00:00:00 postgres: wal writer process

highgo 1882 1876 0 15:28 ? 00:00:00 postgres: autovacuum launcher process

highgo 1883 1876 0 15:28 ? 00:00:00 postgres: archiver process last was 00000001000000000000007A

highgo 1884 1876 0 15:28 ? 00:00:00 postgres: stats collector process

highgo 4347 1876 0 18:19 ? 00:00:11 postgres: htest htest [local] idle

highgo 5029 1876 0 18:43 ? 00:00:00 postgres: htest htest_c localhost(43332) idle

highgo 5030 1876 0 18:43 ? 00:00:00 postgres: htest htest_c localhost(43334) idle

highgo 5031 1876 0 18:43 ? 00:00:00 postgres: htest htest_c localhost(43336) idle

highgo 5032 1876 0 18:43 ? 00:00:00 postgres: htest htest_c localhost(43338) idle

highgo 5033 1876 88 18:43 ? 00:00:03 postgres: htest htest_c localhost(43340) COPY

3.4 验证数据

htest:

htest=# select count(*) from bxtest where a = ‘16097’;

count


24

(1 row)

htest_c:

htest=# \c htest_c htest

PSQL: Release 4.7.7

Connected to:

HighGo Database V4.7 Enterprise Edition Release 4.7.7 - 64-bit Production

You are now connected to database “htest_c” as user “htest”.

htest_c=# select count(*) from bxtest where a = ‘16097’;

count


24

(1 row)

3.5 使用超级用户开启autovacuum(如果做了3.2)

alter system set autovacuum=on;

select pg_reload_conf();

4 注意事项

1、 通过max_connections参数和查询当前数据库连接数占用数确保有足够的连接数可供并行进程导出。

2、 并行导出参数必须和 -F d 参数结合使用,因为这是唯一一种让多个进程能在同一时间写其数据的输出格式。

3、 pg_dump将打开njobs + 1 个到该数据库的连接。

更多详细信息请登录【瀚高技术支持平台】查看https://support.highgo.com/#/index/docContent/f11a7650005a21ba

瀚高数据库并行导入导出相关推荐

  1. Expdp/Impdp 并行导入导出详细测试

    关于Expdp/Impdp 并行导入导出详细测试结果和并行参数的正确理解!! 由于准备做一个120G左右的数据库的数据迁移,使用EXPDP和impdp做了一系列的测试 导出环境 4CPU AIX P4 ...

  2. oracle数据库数据导入导出步骤(入门)

    oracle数据库数据导入导出步骤(入门) 说明:  1.数据库数据导入导出方法有多种,可以通过exp/imp命令导入导出,也可以用第三方工具导出,如:PLSQL  2.如果熟悉命令,建议用exp/i ...

  3. cmd imp导入dmp文件_这是一篇长篇入门级数据库讲解:oracle数据库数据导入导出步骤...

    正如标题一样,本文内容主要介绍了浅谈入门级oracle数据库数据导入导出步骤,文章通过步骤解析介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧!!! ...

  4. oracle临时表经常被锁_这是一篇长篇入门级数据库讲解:oracle数据库数据导入导出步骤

    正如标题一样,本文内容主要介绍了浅谈入门级oracle数据库数据导入导出步骤,文章通过步骤解析介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧!!! ...

  5. oracle数据库数据导入导出步骤

    oracle数据库数据导入导出步骤(基础) 前言: Oracle Database,又名Oracle RDBMS,或简称Oracle.是甲骨文公司的一款关系数据库管理系统.它是在数据库领域一直处于领先 ...

  6. oracle 加载数据戽_oracle数据库数据导入导出步骤(入门)

    oracle数据库数据导入导出步骤(入门) 说明: 1.数据库数据导入导出方法有多种,可以通过exp/imp命令导入导出,也可以用第三方工具导出,如:PLSQL 2.如果熟悉命令,建议用exp/imp ...

  7. 瀚高数据库优化解决方案

    本文转自微信公众号"瀚高数据库售前团队"文章https://mp.weixin.qq.com/s/iYwAAc6HWPt2bJbCIbKKfg 声明: 本文章内容仅用于学习.交流, ...

  8. MySQL数据库中导入导出方法以及工具介绍

    MySQL数据库中导入导出方法以及工具介绍 1.MySQLimport的语法介绍: mysqlimport位于mysql/bin目录中,是mysql的一个载入(或者说导入)数据的一个非常有效的工具.这 ...

  9. ORACLE数据库在导入导出时序列不一致的问题

    ORACLE数据库在导入导出时序列不一致的问题 在使用ORACLE数据库时,当给一个表设置自增字段时,我们经常会使用到序列+触发器来完成.但当你需要对数据库进行导入导出时,序列很容易出问题. 当你将数 ...

  10. mysql partition 语法,MySQL与瀚高数据库的范围分区的语法及实例(APP)

    目录 环境 文档用途 详细信息 环境 系统平台:Microsoft Windows (64-bit) 10 版本:5.6.4 文档用途 当表中的数据量不断增大,查询数据的速度就会变慢,应用程序的性能就 ...

最新文章

  1. Debian手动修改ip地址
  2. python3.7如何安装库_Python3.7版库的安装以及常用方法(十分简单)
  3. multipart/form-data ajax 提交问题(未解决)
  4. stm32f103zet6实现HTTP协议请求,UTF-8转码JSON打包上传
  5. java填空题 在非静态成员方法中_Java程序设计填空和改错题(参考答案)
  6. php 数组 组成新数组,PHP让数组中相同值的组组成新的数组详解
  7. Analyzer普通用户登录不了[从网络访问此计算机]
  8. python 调用控制台并获取返回结果_python脚本执行CMD命令并返回结果的例子
  9. 支持移动手持设备智能图表控件JavaScript charts
  10. 考场自动安排工具开发手记
  11. 今日头条的企业服务产品线
  12. 2018 PKU_WC 长沙游 《我到长沙来看雪》
  13. centos7:configure: error: perl >= 5.7.3 with Encode and Data::Dumper required by Texinfo.
  14. JAVA毕设项目中小型企业资金流管理系统(java+VUE+Mybatis+Maven+Mysql)
  15. 51单片机常用波特率初值表(11.0592M和12M)
  16. luffy-(13)
  17. 主成分分析 (一): 基本思想与主成分估计方法
  18. nginx: [emerg] “location“ directive is not allowed here
  19. LSM树——Log-Structured Merge-Tree数据结构、LSM树设计思想、LSM的数据写入操作、LSM的数据查询操作
  20. 一条命令导出电脑中所有wifi账号密码

热门文章

  1. 区块链与大数据,打造智能经济(读书笔记)——井底望天
  2. sqlserver数据库快照和mysql_解析SQLServer视图、数据库快照_MySQL
  3. godaddy 域名转向指南
  4. 知识经济杂志知识经济杂志社知识经济编辑部2022年第33期目录
  5. HTML在线转换成PDF
  6. 一个大学教授让人发冷汗的讲演(浙大高分子物理郑强教授)
  7. 新手写的一个12306刷票工具
  8. python--step-01
  9. css空心三角形_CSS实现空心三角指示箭头
  10. 对静态页面的一些理解