Re: Simulation output using libpq

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Daryl Shanley <Daryl(dot)Shanley(at)newcastle(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Simulation output using libpq
Date: 2004-01-09 04:16:37
Message-ID: 20040109041637.GC31586@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 06, 2004 at 10:50:57 -0000,
Daryl Shanley <Daryl(dot)Shanley(at)newcastle(dot)ac(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arnold Mavromatis 2004-01-09 04:32:44 How are NULLS stored on disk for PG 7.4?
Previous Message Bruno Wolff III 2004-01-09 04:13:48 Re: cross-table unique constraint