From JManni@FireEye.com Wed Nov 4 03:08:18 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7C54263222F for ; Tue, 3 Nov 2009 23:08:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70523-03 for ; Wed, 4 Nov 2009 03:08:09 +0000 (UTC) X-Greylist: delayed 00:05:14.364418 by SQLgrey-1.7.6 Received: from fempexch.FireEye.com (mail2.FireEye.com [12.68.100.48]) by mail.postgresql.org (Postfix) with ESMTP id 6F57A633847 for ; Tue, 3 Nov 2009 23:08:09 -0400 (AST) Received: from mail2.FireEye.com ([192.168.0.116]) by fempexch.FireEye.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 3 Nov 2009 19:02:52 -0800 Received: from mail2.FireEye.com ([fe80::c1f0:c46:3b66:3f6c]) by mail2.FireEye.com ([fe80::c1f0:c46:3b66:3f6c%11]) with mapi; Tue, 3 Nov 2009 19:02:52 -0800 From: Jay Manni To: "pgsql-performance@postgresql.org" Date: Tue, 3 Nov 2009 19:02:50 -0800 Subject: High Frequency Inserts to Postgres Database vs Writing to a File Thread-Topic: High Frequency Inserts to Postgres Database vs Writing to a File Thread-Index: Acpc+0ubBi18HvW7SG6CVEDg9si6Ow== Message-ID: <60B0F2124D07B942988329B5B7CA393D01E5B93FF4@mail2.FireEye.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF4mail2FireEyec_" MIME-Version: 1.0 X-OriginalArrivalTime: 04 Nov 2009 03:02:52.0303 (UTC) FILETIME=[4C7911F0:01CA5CFB] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200911/74 X-Sequence-Number: 36242 --_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF4mail2FireEyec_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi: I have an application wherein a process needs to read data from a stream an= d store the records for further analysis and reporting. The data in the str= eam is in the form of variable length records with clearly defined fields -= so it can be stored in a database or in a file. The only caveat is that th= e rate of records coming in the stream could be several 1000 records a seco= nd. The design choice I am faced with currently is whether to use a postgres da= tabase or a flat file for this purpose. My application already maintains a = postgres (8.3.4) database for other reasons - so it seemed like the straigh= tforward thing to do. However I am concerned about the performance overhead= of writing several 1000 records a second to the database. The same databas= e is being used simultaneously for other activities as well and I do not wa= nt those to be adversely affected by this operation (especially the query t= imes). The advantage of running complex queries to mine the data in various= different ways is very appealing but the performance concerns are making m= e wonder if just using a flat file to store the data would be a better appr= oach. Anybody have any experience in high frequency writes to a postgres database= ? - Jay --_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF4mail2FireEyec_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi:

 =

I have an applica= tion wherein a process needs to read data from a stream and store the records fo= r further analysis and reporting. The data in the stream is in the form of variable length records with clearly defined fields – so it can be st= ored in a database or in a file. The only caveat is that the rate of records com= ing in the stream could be several 1000 records a second.

 =

The design choice= I am faced with currently is whether to use a postgres database or a flat file f= or this purpose. My application already maintains a postgres (8.3.4) database for o= ther reasons – so it seemed like the straightforward thing to do. However = I am concerned about the performance overhead of writing several 1000 records a second to the database. The same database is being used simultaneously for other activities as well and I do not want those to be adversely affected b= y this operation (especially the query times). The advantage of running compl= ex queries to mine the data in various different ways is very appealing but th= e performance concerns are making me wonder if just using a flat file to stor= e the data would be a better approach.

 =

Anybody have any experience in high frequency writes to a postgres database?

 =

- Jay<= /span>

--_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF4mail2FireEyec_-- From JManni@FireEye.com Wed Nov 4 03:12:41 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9B9206335BC for ; Tue, 3 Nov 2009 23:12:41 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70871-09 for ; Wed, 4 Nov 2009 03:12:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fempexch.FireEye.com (mail2.FireEye.com [12.68.100.48]) by mail.postgresql.org (Postfix) with ESMTP id BC52E63222F for ; Tue, 3 Nov 2009 23:12:32 -0400 (AST) Received: from mail2.FireEye.com ([192.168.0.116]) by fempexch.FireEye.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 3 Nov 2009 19:12:31 -0800 Received: from mail2.FireEye.com ([fe80::c1f0:c46:3b66:3f6c]) by mail2.FireEye.com ([fe80::c1f0:c46:3b66:3f6c%11]) with mapi; Tue, 3 Nov 2009 19:12:31 -0800 From: Jay Manni To: "pgsql-performance@postgresql.org" Date: Tue, 3 Nov 2009 19:12:29 -0800 Subject: High Frequency Inserts to Postgres Database vs Writing to a File Thread-Topic: High Frequency Inserts to Postgres Database vs Writing to a File Thread-Index: Acpc+0ubBi18HvW7SG6CVEDg9si6OwAAU87A Message-ID: <60B0F2124D07B942988329B5B7CA393D01E5B93FF7@mail2.FireEye.com> References: <95652FF3B9EF3045AC4AE8FE5AF8671EED65CF6B@mail2.FireEye.com> In-Reply-To: <95652FF3B9EF3045AC4AE8FE5AF8671EED65CF6B@mail2.FireEye.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF7mail2FireEyec_" MIME-Version: 1.0 X-OriginalArrivalTime: 04 Nov 2009 03:12:31.0303 (UTC) FILETIME=[A5957570:01CA5CFC] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200911/37 X-Sequence-Number: 36205 --_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF7mail2FireEyec_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi: I have an application wherein a process needs to read data from a stream an= d store the records for further analysis and reporting. The data in the str= eam is in the form of variable length records with clearly defined fields -= so it can be stored in a database or in a file. The only caveat is that th= e rate of records coming in the stream could be several 1000 records a seco= nd. The design choice I am faced with currently is whether to use a postgres da= tabase or a flat file for this purpose. My application already maintains a = postgres (8.3.4) database for other reasons - so it seemed like the straigh= tforward thing to do. However I am concerned about the performance overhead= of writing several 1000 records a second to the database. The same databas= e is being used simultaneously for other activities as well and I do not wa= nt those to be adversely affected by this operation (especially the query t= imes). The advantage of running complex queries to mine the data in various= different ways is very appealing but the performance concerns are making m= e wonder if just using a flat file to store the data would be a better appr= oach. Anybody have any experience in high frequency writes to a postgres database= ? - Jay --_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF7mail2FireEyec_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi:

 =

I have an applica= tion wherein a process needs to read data from a stream and store the records fo= r further analysis and reporting. The data in the stream is in the form of variable length records with clearly defined fields – so it can be st= ored in a database or in a file. The only caveat is that the rate of records coming i= n the stream could be several 1000 records a second.

 =

The design choice= I am faced with currently is whether to use a postgres database or a flat file f= or this purpose. My application already maintains a postgres (8.3.4) database = for other reasons – so it seemed like the straightforward thing to do. Ho= wever I am concerned about the performance overhead of writing several 1000 records a second to the database. The same database is being used simultaneously for other activities as well and I do not want those to be adversely affected b= y this operation (especially the query times). The advantage of running compl= ex queries to mine the data in various different ways is very appealing but th= e performance concerns are making me wonder if just using a flat file to stor= e the data would be a better approach.

 =

Anybody have any experience in high frequency writes to a postgres database?

 =

- Jay<= /span>

--_000_60B0F2124D07B942988329B5B7CA393D01E5B93FF7mail2FireEyec_-- From scott.marlowe@gmail.com Wed Nov 4 03:35:32 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5AE686321E7 for ; Tue, 3 Nov 2009 23:35:32 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 63878-06 for ; Wed, 4 Nov 2009 03:35:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f186.google.com (mail-iw0-f186.google.com [209.85.223.186]) by mail.postgresql.org (Postfix) with ESMTP id 891136335BC for ; Tue, 3 Nov 2009 23:35:21 -0400 (AST) Received: by iwn16 with SMTP id 16so4497298iwn.29 for ; Tue, 03 Nov 2009 19:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rBVJXSTTlsjKC0Msa+5sieYCWjs+tjulvk/3WEKoyBQ=; b=wtwL0hN0HA21WQBbn5n0p+r6TnKBDlan6sRGwTNfjzFkbuprxnUGk24Ometykjnjp+ Ru/fSVksLqBTtfS4FQSC/S+ftr+evKjHxJtl0VSH2Vs5doUtXwMrcLoNjwdDbV8LfHUE XxStuEcyPSF8ViyCn2wyoFGCNaoerb7Zy2x0s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=kBu+faRDY5vsT7YkQ45MeEw4yz99i+Bi5XrSmV5LXlJw36US2NNf9LJPH76hWcVH87 dtUwOW4TF4qhVsMq6VnKVs62fUR7b/W8kHLB9IteszgaDkbCyd3E/pDkuFhOgJfzSTpg YDLp881Til148tvcDR/153VWkpRvfinj79rMQ= MIME-Version: 1.0 Received: by 10.231.5.23 with SMTP id 23mr2488765ibt.45.1257305719481; Tue, 03 Nov 2009 19:35:19 -0800 (PST) In-Reply-To: <60B0F2124D07B942988329B5B7CA393D01E5B93FF7@mail2.FireEye.com> References: <95652FF3B9EF3045AC4AE8FE5AF8671EED65CF6B@mail2.FireEye.com> <60B0F2124D07B942988329B5B7CA393D01E5B93FF7@mail2.FireEye.com> Date: Tue, 3 Nov 2009 20:35:19 -0700 Message-ID: Subject: Re: High Frequency Inserts to Postgres Database vs Writing to a File From: Scott Marlowe To: Jay Manni Cc: "pgsql-performance@postgresql.org" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.506 tagged_above=-10 required=5 tests=AWL=0.093, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/38 X-Sequence-Number: 36206 On Tue, Nov 3, 2009 at 8:12 PM, Jay Manni wrote: > Hi: > > > > I have an application wherein a process needs to read data from a stream = and > store the records for further analysis and reporting. The data in the str= eam > is in the form of variable length records with clearly defined fields =96= so > it can be stored in a database or in a file. The only caveat is that the > rate of records coming in the stream could be several 1000 records a seco= nd. > > > > The design choice I am faced with currently is whether to use a postgres > database or a flat file for this purpose. My application already maintain= s a A common approach is to store them in flat files, then insert the flat files at a later time so that if the db falls behind no data is lost. From dsaracini@yahoo.com Wed Nov 4 03:42:18 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D0DA963353A for ; Tue, 3 Nov 2009 23:42:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 75280-02 for ; Wed, 4 Nov 2009 03:42:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from n4.bullet.mail.ac4.yahoo.com (n4.bullet.mail.ac4.yahoo.com [76.13.13.28]) by mail.postgresql.org (Postfix) with SMTP id B944063222F for ; Tue, 3 Nov 2009 23:42:10 -0400 (AST) Received: from [76.13.13.25] by n4.bullet.mail.ac4.yahoo.com with NNFMP; 04 Nov 2009 03:42:09 -0000 Received: from [67.195.9.81] by t4.bullet.mail.ac4.yahoo.com with NNFMP; 04 Nov 2009 03:42:08 -0000 Received: from [98.137.27.209] by t1.bullet.mail.gq1.yahoo.com with NNFMP; 04 Nov 2009 03:42:08 -0000 Received: from [127.0.0.1] by omp119.mail.gq1.yahoo.com with NNFMP; 04 Nov 2009 03:42:08 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 768324.1217.bm@omp119.mail.gq1.yahoo.com Received: (qmail 38005 invoked by uid 60001); 4 Nov 2009 03:42:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=uH1+R54ESznWQUEgLctlUZBFqhypwwXjGMwI2HU7TccLYLQiZIOuWrd3IZMO+87wpNQEPsndj/g/uHAaO10WmrXUww5jRLCq0/v2E/sR+LceBvh4WWiokNMt7KDw/nQqscLhz1rnYTuHGFgwNFqFhPBNuwNySVTXH5hk/7DPWaQ=; Message-ID: <582494.35747.qm@web180304.mail.gq1.yahoo.com> X-YMail-OSG: NQpIiakVM1mqW9Z5H8Lgjb1GdMguRj2lENFislA7dzrqvv8Ej3vBFcStJiWbMFRUqYwdZSBjShEx3BgKAv9D2rvjJi21jlvLBlzgz7Fw_dVYPdnJQgQkuQqBx1kP3z3tKcr8iKG6RiYNCqMuIj6DKAEDcJLlUCuX98Uyc4BhwsRJ1NzfZif_xsjqnVKt3XZOtPsmKuTpkmg2cadNgcIcbc_cPbo6hqgANUkyhs1daB7kF2zAkTu_HsohcEDgrUkDjoUtZa.CLiMnVdx4c1F5c4A4ZFqCvwqrL9K.3Lth.vPv.RuCawDxdbLMTTagdQlgEeCK3ZcdgBJYaV0ZyZbZiJSYtyVf1CJdb2MShN_uKKJmbz379r7OLKnK Received: from [67.170.81.155] by web180304.mail.gq1.yahoo.com via HTTP; Tue, 03 Nov 2009 19:42:08 PST X-Mailer: YahooMailRC/211.6 YahooMailWebService/0.7.347.3 References: <95652FF3B9EF3045AC4AE8FE5AF8671EED65CF6B@mail2.FireEye.com> <60B0F2124D07B942988329B5B7CA393D01E5B93FF7@mail2.FireEye.com> Date: Tue, 3 Nov 2009 19:42:08 -0800 (PST) From: David Saracini Subject: Re: High Frequency Inserts to Postgres Database vs Writing to a File To: Jay Manni , "pgsql-performance@postgresql.org" In-Reply-To: <60B0F2124D07B942988329B5B7CA393D01E5B93FF7@mail2.FireEye.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1442661790-1257306128=:35747" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200911/39 X-Sequence-Number: 36207 --0-1442661790-1257306128=:35747 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "could be several 1000 records a second."=0A=0ASo, are there periods when t= here are no/few records coming in? Do the records/data/files really need t= o be persisted? =0A=0AThe following statement makes me think you should go= the flat file route:=0A=0A"The advantage of running complex queries to min= e the data in various different ways is very appealing"=0A=0APlease don't b= e offended, but that sounds a little like feature creep. I've found that i= t's best to keep it simple and don't do a bunch of work now for what might = be requested in the future.=0A=0AI know it's not exactly what you were look= ing for... Just food for thought.=0A=0ABest of luck!=0A=0ADavid=0A=0A=0A= =0A________________________________=0AFrom: Jay Manni = =0ATo: "pgsql-performance@postgresql.org" =0ASent: Tue, November 3, 2009 7:12:29 PM=0ASubject: [PERFORM] High Freque= ncy Inserts to Postgres Database vs Writing to a File=0A=0A =0AHi:=0A =0AI = have an application=0Awherein a process needs to read data from a stream an= d store the records for=0Afurther analysis and reporting. The data in the s= tream is in the form of=0Avariable length records with clearly defined fiel= ds =E2=80=93 so it can be stored in a=0Adatabase or in a file. The only cav= eat is that the rate of records coming in=0Athe stream could be several 100= 0 records a second. =0A =0AThe design choice I am=0Afaced with currently is= whether to use a postgres database or a flat file for=0Athis purpose. My a= pplication already maintains a postgres (8.3.4) database for=0Aother reason= s =E2=80=93 so it seemed like the straightforward thing to do. However I am= =0Aconcerned about the performance overhead of writing several 1000 records= a=0Asecond to the database. The same database is being used simultaneously= for=0Aother activities as well and I do not want those to be adversely aff= ected by=0Athis operation (especially the query times). The advantage of ru= nning complex=0Aqueries to mine the data in various different ways is very = appealing but the=0Aperformance concerns are making me wonder if just using= a flat file to store=0Athe data would be a better approach. =0A =0AAnybody= have any=0Aexperience in high frequency writes to a postgres database?=0A = =0A- Jay --0-1442661790-1257306128=:35747 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
"could be several 1000 records a second."

<= div>So, are there periods wh= en there are no/few records coming in?  Do the records/data/files real= ly need to be persisted?  

The following statement makes me think you should go the flat file route:

"The ad= vantage of running complex queries to mine the data in various different wa= ys is very appealing"

Please don't be offended, but that sounds a little like = feature creep.  I've found that it's best to keep it simple and don't = do a bunch of work now for what might be requested in the future.

I know it's not exactly what you= were looking for...  Just food for thought.
<= font class=3D"Apple-style-span" face=3D"Consolas" size=3D"4">
= Best of luck!
<= span class=3D"Apple-style-span" style=3D"font-size: 15px;">
= David

From: Jay Mann= i <JManni@FireEye.com>
To: "pgsql-performance@postgresql.org" <pgsql-performance@postgres= ql.org>
Sent: Tue, N= ovember 3, 2009 7:12:29 PM
Subject= : [PERFORM] High Frequency Inserts to Postgres Database vs Writi= ng to a File

=0A=0A=0A=0A =0A =0A