Search Postgresql Archives

psql scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a file which is a long series of SQL commands.  Creating
tables, copying in data, indexing, munging the data, intermittently
vacuuming to keep things moving.

I have usually run this big script like this:

nohup psql dbname < script.sql &

After upgrading to 8.0, the script to slow to a crawl after a while.  
However, it works fine when run from inside a psql session like this

\i script.sql

All I can think of is that the entire script is running in one big
transaction, although there are no explicit BEGIN statements in it.

The man page for psql says, regarding the -c option

"If the command string contains multiple SQL commands, they are
processed in a single transaction, unless there are explicit
BEGIN/COMMIT commands included in the string to divide it into
multiple transactions. This is different from the behavior when the
same string is fed to psql's standard input."

implying that stdin is run exactly the same as \i.

That being the case, what could be causing my script to slow to a
crawl when redirected to psql, but run fine from inside psql with -i?

- Ian

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux