Re: PostgreSQL Write Performance

Поиск
Список
Период
Сортировка
От Dann Corbit
Тема Re: PostgreSQL Write Performance
Дата
Msg-id D425483C2C5C9F49B5B7A41F89441547029626B5@postal.corporate.connx.com
обсуждение исходный текст
Ответ на Re: PostgreSQL Write Performance  (Yan Cheng Cheok <yccheok@yahoo.com>)
Ответы Re: PostgreSQL Write Performance  (Yan Cheng Cheok <yccheok@yahoo.com>)
Re: PostgreSQL Write Performance  (Tim Uckun <timuckun@gmail.com>)
Список pgsql-general
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Yan Cheng Cheok
> Sent: Monday, January 04, 2010 9:05 PM
> To: Scott Marlowe
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] PostgreSQL Write Performance
>
> Instead of sending 1000++ INSERT statements in one shot, which will
> requires my application to keep track on the INSERT statement.
>
> Is it possible that I can tell PostgreSQL,
>
> "OK. I am sending you INSERT statement. But do not perform any actual
> right operation. Only perform actual write operation when the pending
> statement had reached 1000"

You might use the copy command instead of insert, which is far faster.
If you want the fastest possible inserts, then probably copy is the way
to go instead of insert.
Here is copy command via API:
http://www.postgresql.org/docs/current/static/libpq-copy.html
Here is copy command via SQL:
http://www.postgresql.org/docs/8.4/static/sql-copy.html


You might (instead) use this sequence:

1. Begin transaction
2. Prepare
3. Insert 1000 times
4. Commit

If the commit fails, you will have to redo the entire set of 1000 or
otherwise handle the error.

Or something along those lines.  Of course, when information is not
written to disk, what will happen on power failure?  If you do something
cheesy like turning fsync off to speed up inserts, then you will have
trouble if you lose power.

What is the actual problem you are trying to solve?


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: PostgreSQL Write Performance
Следующее
От: Greg Smith
Дата:
Сообщение: Re: timestams in the the pg_standby output