good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Can't get multiple Parallel::ForkManager threads connecting to DBD::Pg databaseby NetWallah (Canon) |
on Jul 22, 2021 at 04:04 UTC ( [id://11135281]=note: print w/replies, xml ) | Need Help?? |
There is a similar, reasonable answer on StackOverflow relating to Postgres parallel access via python.
You can't sanely share a DB connection across processes like that. You can sort-of share a connection between threads, but only if you make sure the connection is only used by one thread at a time. That won't work between processes because there's client-side state for the connection stored in the client's address space. "The difficult we do today; the impossible takes a little longer."
In Section
Seekers of Perl Wisdom
|
|