I have been trying to import a .sql file to my pgAdmin 4 since 2 hours now. I have a Windows and PostgreSQL 14.
I realized I approached correctly since I was able to import a small (2KB) file (through drag and drop or through the 'Open File' menubar. However, if I want to do the same for my 160GB .sql file it does not work. Any suggestions what I can do?
1 Answer 1
I'd say that pgAdmin is the wrong tool for that. Do you really want to load an 160GB file into your query tool window?
Use psql
, which is installed on your system, on the command line:
psql -h server_name -p 5432 -U dbuser -d dbname -f script.sql
-
Sadly that does not work
'psql' is not recognized as an internal or external command, operable program or batch file.
josh– josh2021年11月11日 07:50:56 +00:00Commented Nov 11, 2021 at 7:50 -
Sure that works. Either put the PostgreSQL binary directory in your
PATH
, or use an absolute path:"C:\Program Files\.....\bin\psql.exe" -h server_name ...
(fill in the missing parts).Laurenz Albe– Laurenz Albe2021年11月11日 08:09:42 +00:00Commented Nov 11, 2021 at 8:09 -
@josh: that error has nothing to do with Postgres. You need to setup your environment correctly. See here for some solutionsuser1822– user18222021年11月11日 09:44:49 +00:00Commented Nov 11, 2021 at 9:44
-
Hi I tried this command line process also but its taking for me around one day but still while checked the database its showing me the countrows as 18 mbSailendra– Sailendra2023年07月26日 09:16:09 +00:00Commented Jul 26, 2023 at 9:16
PSQL tool
they thought you would use that instead.