Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by RichardK (Vicar)
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)
Replies are listed 'Best First'.
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 meditating upon the Monastery: (5)
As of 2015-07-30 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls