pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michal Táborský <michal@taborsky.cz>
To: pgsql-performance@postgresql.org
Subject: Slow INSERT
Date: Tue, 29 Jun 2004 14:30:30 +0200
Message-ID: <40E160E6.4080105@taborsky.cz> (raw)

I am experiencing rather slow INSERTs on loaded server. The table I am 
inserting to is:

CREATE TABLE pagestats
(
   page_id int4 NOT NULL,
   viewed timestamptz DEFAULT now(),
   session int4 NOT NULL
) WITH OIDS;

The table is populated with 700k rows. It is VACUUM ANALYZED every 
night, though it is only INSERTED to and SELECTED from, no UPDATES or 
DELETES. There are no indices, triggers or constraints attached to it. 
There are about 5 inserts pre second (sometimes more, but 10/s max).

The INSERT is:
INSERT INTO pagestats (page_id,session) VALUES (5701,1147421823)

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). The only special thing about this table is, it does not 
have a PRIMARY KEY, but I should think that this constraint would only 
slow it down even more.

Any ideas what can be wrong?

-- 
Michal Taborsky
http://www.taborsky.cz




view thread (8+ messages)  latest in thread

Message-ID: <40E160E6.4080105@taborsky.cz>
Permalink:  ../40E160E6.4080105@taborsky.cz/
Also on:    postgresql.org/message-id/40E160E6.4080105@taborsky.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: michal@taborsky.cz
  Subject: Re: Slow INSERT
  In-Reply-To: <40E160E6.4080105@taborsky.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox