Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Fork a new process for inserting a record in DB (Oracle)

by RichardK (Priest)
on Nov 07, 2013 at 14:12 UTC ( #1061576=note: print w/ replies, xml ) Need Help??


in reply to Fork a new process for inserting a record in DB (Oracle)

Does each fork create it's own database connection ?

How do you insert the records? one at a time or in batches? If you're looking for speed it's usually best to batch your inserts into one transaction. So turn autocommit off and handle them yourself.


Comment on Re: Fork a new process for inserting a record in DB (Oracle)
Re^2: Fork a new process for inserting a record in DB (Oracle)
by Anonymous Monk on Nov 07, 2013 at 14:19 UTC
    Yes. I'm opening a DB connection for each thread and closing the connection. When I run the script... it just runs fine for first few seconds.... and then throws the above error...

      Wow. That's a completely brutal way of doing it. Think of how much work is involved in setting up a database connection, doing one insert, and then tearing down that connection.

      A better way might be to split the data into 20 chunks, and then pass each of the chunks to a separate process.

      Alex / talexb / Toronto

      Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-12-27 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls