Re: Slow INSERT - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow INSERT
Date
Msg-id 29095.1088519446@sss.pgh.pa.us
Whole thread Raw
In response to Slow INSERT  (Michal Táborský <michal@taborsky.cz>)
Responses Re: Slow INSERT  (Michal Taborsky <michal@taborsky.cz>)
List pgsql-performance
=?ISO-8859-2?Q?Michal_T=E1borsk=FD?= <michal@taborsky.cz> 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: postgres 7.4 at 100%
Next
From: Michal Taborsky
Date:
Subject: Re: Slow INSERT