Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9E08465008C for ; Fri, 22 Aug 2008 22:41:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45067-03 for ; Fri, 22 Aug 2008 22:41:25 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.234]) by postgresql.org (Postfix) with ESMTP id 01AAF64FD35 for ; Fri, 22 Aug 2008 22:41:30 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id i31so318412wxd.28 for ; Fri, 22 Aug 2008 18:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:x-google-sender-auth; bh=vtnlaJ9xBW79aW3Jmov4T6woqwdea9djsi+DY65Qgww=; b=JJBjeTcCBrryJtM9s9qDKr5PQLwl7t0i7Z4HAscJvt0MgXn1lqcBqTozvv+i+7LjBz 779qKV1A5V1GJALdp9ERTESDl1AqEXf8BwV35IGZ3gloOMiL2mwR+qXhs/TMVDmZ/coV K/06CVAhWFF+DZ6fp4Y74JSN54m5i4hAI3h5g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :x-google-sender-auth; b=jom5F38ocN5lgsPbIDEXhKWEpaA22irhlJxsZc3LRmYE831GR7HAbmlSEWzQBNa7uW m3aaSB876DXwhPvNBlMuGGoM6WrjQd3cvQDepBx4vYzXkdo86uzLK+TVwxBmZ2DZ9mef rvUo46018T66o/PzA0hesiIQDXU7qI3gaqn84= Received: by 10.70.44.18 with SMTP id r18mr2170386wxr.60.1219455687876; Fri, 22 Aug 2008 18:41:27 -0700 (PDT) Received: by 10.70.22.18 with HTTP; Fri, 22 Aug 2008 18:41:27 -0700 (PDT) Message-ID: <1775c5ea0808221841u746862e3h1b721ea82fdb7794@mail.gmail.com> Date: Sat, 23 Aug 2008 02:41:27 +0100 From: "Loic Petit" To: pgsql-performance@postgresql.org Subject: Large number of tables slow insert MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_87450_19407732.1219455687833" X-Google-Sender-Auth: 3faaf0d79eb20905 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200808/290 X-Sequence-Number: 31171 ------=_Part_87450_19407732.1219455687833 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 creat= e 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=3DFALSE); 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=EFc Petit ------=_Part_87450_19407732.1219455687833 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
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 f= or 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 a= t 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 (O= IDS=3DFALSE);
CREATE INDEX measures_0_1_idx
 ON measures_0
&n= bsp;USING btree
 ((value[1]));

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

-- I= ndex: measures_0_3_idx
CREATE INDEX measures_0_3_idx
 ON measure= s_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 btr= ee
 (value);
---------------------------------------------------= ----

Regards

Lo=EFc Petit

------=_Part_87450_19407732.1219455687833--