如何将一个巨大的文件导入PostgreSQL? [英] How to import a huge file into PostgreSQL?

查看:815
本文介绍了如何将一个巨大的文件导入PostgreSQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个新项目中,我现在必须使用现有的PostgreSQL数据库。该应用程序使用CakePHP构建。我在导入时面临的问题是数据库的文件大小约为4.8 GB,我对PostgreSQL完全不熟悉。

I am in a new project and I have to work with an existing PostgreSQL database now. The application is built with CakePHP. The problem I am facing while importing is that the file size of the database is around 4.8 GBs and I am totally new to PostgreSQL.

我曾经使用过MySql和NoSqls但是PostgreSQL对我来说似乎是个棘手的部分。
我甚至尝试通过Console导入文件,但又失败了。我在Ubuntu(Core i3)上使用PostgreSQL。请帮助我。

I have worked on MySql and NoSqls but PostgreSQL is appearing to be a tricky part for me. I even tried to import the file via Console, but again failed. I am using PostgreSQL on Ubuntu (Core i3). Please help me out of this.

提前致谢。

Nishant Shrivastava

Nishant Shrivastava

推荐答案

还有更多可能性

psql yourdb -f yourfile
psql yourdb < yourfile
cat yourfile | psql yourdb

psql yourdb
\i yourdb

这篇关于如何将一个巨大的文件导入PostgreSQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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