Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: SQLite Slow insert

by afoken (Prior)
on Feb 17, 2013 at 19:24 UTC ( #1019197=note: print w/ replies, xml ) Need Help??


in reply to SQLite Slow insert

Some ideas:

  • Move the prepare out of the while loop. No need to prepare the same statement more than once.
  • Use placeholders to get rid of SQL injection problems, and to improve performace by allowing to cache the prepared statement inside the database engine.
  • prepare the insert statement outside the while loop, and use placeholders, for the same reasons.
  • Disable auto-commit, and commit manually every few thousand rows, as recommended by the SQLite FAQ.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)


Comment on Re: SQLite Slow insert
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2015-07-01 21:27 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 (22 votes), past polls