feeding big script to psql

Поиск
Список
Период
Сортировка
От Havasvölgyi Ottó
Тема feeding big script to psql
Дата
Msg-id 001101c596ff$18d227e0$8000a8c0@OTTO
обсуждение исходный текст
Ответ на Tool for database design documentation?  ("Jon Christian Ottersen" <jco@kvikkpass.no>)
Ответы Re: feeding big script to psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

A generated a big SQL script (about 20 Mb), and fed it to psql. I was very
surprised that within a minute psql became quite slow. There were areas,
where less than 10 row were inserted in a second.
This is on a WinXP machine with local server 8.0.3, and only I use it.
Looking at the log files of PG the commands are executed fast.
I have monitored psql with te TaskManager, and it was at 45-50% CPU (this is
Hyperthreaded, so 50% is the max for one thread), and the memory
allocation/deallocation was very active, even about +-2Mb/sec.
The command were simple create table and insert commands chunked into
several lines like this:

CREATE TABLE aeloleg(
vevo CHAR(6),
szallito INTEGER,
datum DATE,
hatarido DATE,
vevo_nev CHAR(30),
ir_szam INTEGER,
helyseg CHAR(20),
cim CHAR(20),
befizetes INTEGER,
terheles INTEGER,
hitel INTEGER,
rendeles INTEGER,
jel CHAR(1),
trans INTEGER,
szoveg TEXT,
storno BOOLEAN) WITHOUT OIDS;

The insert commands for one table were surrounded by BEGIN and COMMIT like
this:

CREATE
BEGIN
INSERT
INSERT
...
INSERT
COMMIT


I know it would be faster with COPY, but this is extremly slow, and the
bottleneck is psql.
What is the problem?

Regards,
Otto



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Check postgres compile-time options
Следующее
От: hisatomo@ctc-g.co.jp
Дата:
Сообщение: could not bind IPv6 socket