转储到CSV/Postgres内存 [英] Dump to CSV/Postgres memory

查看:74
本文介绍了转储到CSV/Postgres内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张大表(3亿行),我想将其转储到csv中-我需要执行一些SQL无法完成的处理.现在,我正在使用Squirrel作为客户端,并且显然不能很好地处理大型数据集-至少从我自己的(有限的)经验中可以看出.如果我在实际主机上运行查询,它将使用更少的内存吗?感谢您的帮助.

I have a large table (300 million lines) that I would like to dump to a csv - I need to do some processing that cannot be done with SQL. Right now I am using Squirrel as a client, and it does not apparently deal very well with large datasets - at least as far as I can tell from my own (limited) experience. If I run the query on the actual host, will it use less memory? Thanks for any help.

推荐答案

尝试一下:

COPY tablename
TO 'filename.csv'
WITH 
      DELIMITER AS  ','
      NULL AS ''
      CSV HEADER

这篇关于转储到CSV/Postgres内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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