[postgres@DELL-R720 bin]$ ./psql -p 6432
psql (9.4.5)
Type "help" for help.

postgres=#
postgres=# \h copy
Command: COPY
Description: copy data between a file and a table
Syntax:
COPY table_name [ ( column_name [, ...] ) ]
FROM { 'filename' | PROGRAM 'command' | STDIN }
[ [ WITH ] ( option [, ...] ) ]

COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
TO { 'filename' | PROGRAM 'command' | STDOUT }
[ [ WITH ] ( option [, ...] ) ]

where option can be one of:

FORMAT format_name
OIDS [ boolean ]
FREEZE [ boolean ]
DELIMITER 'delimiter_character'
NULL 'null_string'
HEADER [ boolean ]
QUOTE 'quote_character'
ESCAPE 'escape_character'
FORCE_QUOTE { ( column_name [, ...] ) | * }
FORCE_NOT_NULL ( column_name [, ...] )
FORCE_NULL ( column_name [, ...] )
ENCODING 'encoding_name'

postgres=# \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------------+-------+--------------+----------+-------------
public | customer | table | benchmarksql | 1772 MB |
public | district | table | benchmarksql | 152 kB |
public | history | table | benchmarksql | 250 MB |
public | item | table | benchmarksql | 10184 kB |
public | new_order | table | benchmarksql | 38 MB |
public | oorder | table | benchmarksql | 198 MB |
public | order_line | table | benchmarksql | 3000 MB |
public | stock | table | benchmarksql | 3392 MB |
public | warehouse | table | benchmarksql | 40 kB |
(9 rows)

postgres=# copy stock to '/tmp/stock.sql';
COPY 10000000
postgres=# truncate stock ;
TRUNCATE TABLE
postgres=# \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------------+-------+--------------+----------+-------------
public | customer | table | benchmarksql | 1772 MB |
public | district | table | benchmarksql | 152 kB |
public | history | table | benchmarksql | 250 MB |
public | item | table | benchmarksql | 10184 kB |
public | new_order | table | benchmarksql | 38 MB |
public | oorder | table | benchmarksql | 198 MB |
public | order_line | table | benchmarksql | 3000 MB |
public | stock | table | benchmarksql | 0 bytes |
public | warehouse | table | benchmarksql | 40 kB |
(9 rows)

postgres=# copy stock from /tmp/stock.sql ;
ERROR: syntax error at or near "/" at character 18
STATEMENT: copy stock from /tmp/stock.sql ;
ERROR: syntax error at or near "/"
LINE 1: copy stock from /tmp/stock.sql ;
^
postgres=# copy stock from '/tmp/stock.sql' ;
COPY 10000000
postgres=# \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------------+-------+--------------+----------+-------------
public | customer | table | benchmarksql | 1772 MB |
public | district | table | benchmarksql | 152 kB |
public | history | table | benchmarksql | 250 MB |
public | item | table | benchmarksql | 10184 kB |
public | new_order | table | benchmarksql | 38 MB |
public | oorder | table | benchmarksql | 198 MB |
public | order_line | table | benchmarksql | 3000 MB |
public | stock | table | benchmarksql | 3392 MB |
public | warehouse | table | benchmarksql | 40 kB |
(9 rows)

最新文章

  1. Nginx支持连接数的问题
  2. jni数据问题
  3. Android recyclerView的空数据显示
  4. Sql Server——查询(二)
  5. Django单元测试简明实践
  6. c#批量抓取免费代理并验证有效性
  7. JS语法转换-ES6转ES5
  8. dispatchEvent(AWTEvent) 分派事件
  9. socket 通信 error:88
  10. 汉语言处理工具pyhanlp的拼音转换与字符正则化
  11. 20款有用的JavaScript和CSS库
  12. Linux命令----uname查看系统信息
  13. linux shell 学习笔记01
  14. [我的阿里云服务器] —— WordPress Permalink Settings
  15. 深入理解Linux内核-页高速缓存
  16. mysql 函数 事务
  17. linux下简单好用的端口映射转发工具rinetd 转
  18. mapjoin与reducejoin
  19. [置顶] 滴滴插件化框架VirtualAPK原理解析(一)之插件Activity管理
  20. django允许跨域请求配置

热门文章

  1. laravel md5+salt 密码
  2. Maximum Likelihood
  3. 1763 An Essay towards solving a Problem in the Doctrine of Chances
  4. ntpdate[16603]: the NTP socket is in use
  5. idea控制台乱码
  6. interview review
  7. 1012 最小公倍数LCM
  8. Jquery 多选下拉列表插件jquery multiselect
  9. 浏览器获取ip地址
  10. [LeetCode]题解(python):034-Search for a Range