Re: really quick multiple inserts can use COPY?

Поиск
Список
Период
Сортировка
От Guillaume Cottenceau
Тема Re: really quick multiple inserts can use COPY?
Дата
Msg-id 87vekiqspr.fsf@meuh.mnc.lan
обсуждение исходный текст
Ответ на really quick multiple inserts can use COPY?  ("Jens Schipkowski" <jens.schipkowski@apus.co.at>)
Ответы Re: really quick multiple inserts can use COPY?  ("Jens Schipkowski" <jens.schipkowski@apus.co.at>)
Список pgsql-performance
"Jens Schipkowski" <jens.schipkowski 'at' apus.co.at> writes:

> Hello!
>
> In our JAVA application we do multiple inserts to a table by data from
> a  Hash Map. Due to poor database access implemention - done by
> another  company (we got the job to enhance the software) - we cannot
> use prepared  statements. (We are not allowed to change code at
> database access!)
> First, we tried to fire one INSERT statement per record to insert.
> This  costs 3 ms per row which is to slow because normally we insert
> 10.000  records which results in 30.000 ms just for inserts.
>
> for(){
> sql = "INSERT INTO tblfoo(foo,bar) VALUES("+it.next()+","+CONST.BAR+");";
> }

You should try to wrap that into a single transaction. PostgreSQL
waits for I/O write completion for each INSERT as it's
implicitely in its own transaction. Maybe the added performance
would be satisfactory for you.

--
Guillaume Cottenceau
Create your personal SMS or WAP Service - visit http://mobilefriends.ch/

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: really quick multiple inserts can use COPY?
Следующее
От: Ron
Дата:
Сообщение: Re: New to PostgreSQL, performance considerations