Re: background jobs

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: background jobs
Дата
Msg-id 20050306132804.GA81378@winnie.fuhr.org
обсуждение исходный текст
Ответ на background jobs  (Kumar S <ps_postgres@yahoo.com>)
Список pgsql-novice
On Sat, Mar 05, 2005 at 09:28:57PM -0800, Kumar S wrote:

>  I am using a laptop and some of my .sql files with
> insert statements (300K insert statements) take very
> long time.

How long is "very long"?  Have you seen the "Performance Tips" chapter
in the documentation, in particular the "Populating a Database" section?

http://www.postgresql.org/docs/8.0/interactive/populate.html

Are you using transactions?  Wrapping a lot of INSERTs in a transaction
should be significantly faster than doing each INSERT as its own
transaction.

Have you considered using COPY instead of INSERT?  COPY should be
significantly faster than INSERT for bulk loads.

> Could any one help to setup a background job where I
> can start a job and forget until the next morning to
> see that the job is finished.
>
> Should it be something like the following:
> myserver$ psql -d mydb -d node2|\i /insert.sql &>

See the psql documentation and your shell's documentation on how to run
a background job and redirect its output; you might also need to use
"nohup".  For example, the following might work in Bourne-like shells
(bash, sh, ksh, etc.):

nohup psql -d mydb -f insert.sql > insert.log 2>&1 &

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

В списке pgsql-novice по дате отправления:

Предыдущее
От: Philip Pinkerton
Дата:
Сообщение: Database drivers
Следующее
От: Kumar S
Дата:
Сообщение: Re: background jobs