pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Loic Petit <tls.wydd@free.fr>
To: pgsql-performance@postgresql.org
Subject: Large number of tables slow insert
Date: Sat, 23 Aug 2008 02:41:27 +0100
Message-ID: <1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com> (raw)

Hi,

I use Postgresql 8.3.1-1 to store a lot of data coming from a large amount
of sensors. In order to have good performances on querying by timestamp on
each sensor, I partitionned my measures table for each sensor. Thus I create
a lot of tables.
I simulated a large sensor network with 3000 nodes so I have ~3000 tables.
And it appears that each insert (in separate transactions) in the database
takes about 300ms (3-4 insert per second) in tables where there is just few
tuples (< 10). I think you can understand that it's not efficient at all
because I need to treat a lot of inserts.

Do you have any idea why it is that slow ? and how can have good insert ?

My test machine: Intel p4 2.4ghz, 512mb ram, Ubuntu Server (ext3)
iostat tells me that I do : 0.5MB/s reading and ~6-7MB/s writing while
constant insert

Here is the DDL of the measures tables:
-------------------------------------------------------
CREATE TABLE measures_0
(
 "timestamp" timestamp without time zone,
 storedtime timestamp with time zone,
 count smallint,
 "value" smallint[]
)
WITH (OIDS=FALSE);
CREATE INDEX measures_0_1_idx
 ON measures_0
 USING btree
 ((value[1]));

-- Index: measures_0_2_idx
CREATE INDEX measures_0_2_idx
 ON measures_0
 USING btree
 ((value[2]));

-- Index: measures_0_3_idx
CREATE INDEX measures_0_3_idx
 ON measures_0
 USING btree
 ((value[3]));

-- Index: measures_0_count_idx
CREATE INDEX measures_0_count_idx
 ON measures_0
 USING btree
 (count);

-- Index: measures_0_timestamp_idx
CREATE INDEX measures_0_timestamp_idx
 ON measures_0
 USING btree
 ("timestamp");

-- Index: measures_0_value_idx
CREATE INDEX measures_0_value_idx
 ON measures_0
 USING btree
 (value);
-------------------------------------------------------

Regards

Loïc Petit

view thread (24+ messages)  latest in thread

Message-ID: <1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com>
Permalink:  ../1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com/
Also on:    postgresql.org/message-id/1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tls.wydd@free.fr
  Subject: Re: Large number of tables slow insert
  In-Reply-To: <1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com>
  References: <1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com>

* 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