问题
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