Re: Simulation output using libpq - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Simulation output using libpq
Date
Msg-id 20040109041637.GC31586@wolff.to
Whole thread Raw
In response to Simulation output using libpq  ("Daryl Shanley" <Daryl.Shanley@newcastle.ac.uk>)
List pgsql-general
On Tue, Jan 06, 2004 at 10:50:57 -0000,
  Daryl Shanley <Daryl.Shanley@newcastle.ac.uk> wrote:
> I have some c code that writes results directly to a file as they're
> produced during a simulation. I want to modify the code to write
> directly to a postgres database using libpq. I think I could open a
> connection and insert into the database with a transaction, commiting at
> the end of the simulation. One problem with this approach is that if I
> have a lot of simultaneous simulations running I may run into problems
> with exceeding the maximum number of connections allowed. I would
> welcome any advice

I think it would be more normal to write the information to files and
then have a cleanup process insert those files into the database and
delete the files. This will keep you from having long running transactions
help open for the duration of a simulation. If you don't want a separate
cleanup process, you could have the simulation process take care of
importing the data after the calculations have been completed.

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: cross-table unique constraint
Next
From: Tom Lane
Date:
Subject: Re: Natural upgrade path for RedHat 9?