将一个大的postgres表拆分为多个csv [英] Split a big postgres table into multiple csv

查看:97
本文介绍了将一个大的postgres表拆分为多个csv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下psql查询连接到远程主机,并将一个大表拆分为多个csv文件。

I am using following psql query to connect to a remote host and split a big table into multiple csv files.

psql -h xx -p xx -U xx -d xx -c "\COPY (select * from table) TO program 'split --lines 1000' (format csv)

我没有在这里弄错什么。

I am not getting what mistake I am making here.

推荐答案

您是否尝试过使用 STDOUT

$ psql -d db -c "COPY (SELECT * FROM t) TO STDOUT CSV " | split -1000

这篇关于将一个大的postgres表拆分为多个csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆