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_--