I have SQL file using PostgreSQL with size about 7GB. How can I open/execute the SQL file? I have researched and tried using Navicat Premium, Razor SQL, HeidiSQL, Workbench. In all I get out of memory. I know for sure it is a PostgreSQL database dump.

  • 7
    use psql -f large_file.sql
    – user1822
    Apr 10, 2016 at 14:46
  • 1
    or use " \i " to execute: psql -h host -p port -U user -d database -c "\i large_file.sql"
    – Luan Huynh
    Apr 11, 2016 at 1:23

2 Answers 2


PostgreSQL database dumps are normally produced by the command line tool pg_dump, and expected to be used via either pg_restore or simply psql command line tools.

However, you can both backup and restore from PgAdminIII. The backup option is available via right-clicking either the server or any database or schema. The Restore option is available via right-clicking a database or schema.

Here's a step-by-step example of how dump or restore a database using PgAdmin.


As a_horse_with_no_name answered in a comment:

use psql -f large_file.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.