Split a big postgres table into multiple csv

旧巷老猫 提交于 2020-02-24 06:49:50

问题


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.


回答1:


Have you tried using STDOUT?

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


来源:https://stackoverflow.com/questions/60187391/split-a-big-postgres-table-into-multiple-csv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!