От: Tom Lane
Тема: Re: Slow INSERT
Дата: ,
Msg-id: 29095.1088519446@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Slow INSERT  (Michal Táborský)
Ответы: Re: Slow INSERT  (Michal Taborsky)
Список: pgsql-performance

Скрыть дерево обсуждения

Slow INSERT  (Michal Táborský, )
 Re: Slow INSERT  (Tom Lane, )
  Re: Slow INSERT  (Michal Taborsky, )
   Re: Slow INSERT  (Tom Lane, )
 Re: Slow INSERT  (Michal Taborsky, )
  Re: Slow INSERT  (Tom Lane, )

=?ISO-8859-2?Q?Michal_T=E1borsk=FD?= <> writes:
> I am experiencing rather slow INSERTs on loaded server.
> ... There are no indices, triggers or constraints attached to it.

It's hard to see how inserting to such a simple table would be slow.

> Sometimes, it takes as long as 1300ms! Other queries are quite swift,
> even compplex SELECTS and most of the INSERTS run fast. But occasionally
> (every 50th or 100th INSERT) it takes forever (and stalls the webpage
> from loading).

Is the number of inserts between slowdowns perfectly repeatable?  My
first thought is that the fast case is associated with inserting onto a
page that is the same one last inserted to, and the slow case is
associated with finding a new page to insert onto (which, given that you
never UPDATE or DELETE, will always mean extending the file).  Given
that the table rows are fixed width, the number of rows that fit on a
page should be constant, so this theory cannot be right if the number of
inserts between slowdowns varies.

Also, are all the inserts being issued by the same server process, or
are they scattered across multiple processes?  I'm not sure this theory
holds water unless all the inserts are done in the same process.

            regards, tom lane

В списке pgsql-performance по дате сообщения:

От: "Mischa Sandberg"
Сообщение: Range query optimization
От: Bruno Wolff III
Сообщение: Re: Query performance