Search Postgresql Archives

Re: Child program using parent program's transaction?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 06, 2006 at 03:21:04PM -0700, Wayne Conrad wrote:
> I work with a system designed as lots of little cooperating worker
> programs, with boss programs that... well, boss the worker programs
> around.
> 
> Boss and workers all use the same database.
<snip>
> Today, it would once again be convenient to have an exec'd program do
> its work in the context of its parent program's transaction.  So,
> before I once again decide that I don't actually want to do that, can
> you tell me... is it possible?  And, would any sane person do it?

The answer is, not really. If you're only fork()ing you can get away
with it as long as you make sure no two processes are accessing the db
at the same time. There's a little too much state to transfer a
connection from one process to another.

What you could do is have a single process that handles the actual
connection to the database and have the other processes talk to it to
do the queries. That way you have complete control over who accesses
what in which connection.

Hope this helps,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux