Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Database input speed question

by chunlou (Curate)
on Jul 31, 2003 at 17:12 UTC ( #279665=note: print w/ replies, xml ) Need Help??


in reply to Database input speed question

In addition to what've been said, the following statement could also be considered if sensible to the program (multiple rows in one insert statement).

INSERT INTO table VALUES (val11,val2), (val21,val22), (val31,val32)

But the DB native batch facility is still the best bet especially if the insert doesn't have to be real time.


Comment on Re: Database input speed question
Download Code
Re: Re: Database input speed question
by Mur (Pilgrim) on Jul 31, 2003 at 17:45 UTC
    I must point out that syntax doesn't work in all DBMS. For PostgreSQL, you'll need something a bit more complex:
    INSERT INTO table SELECT val11, val12 UNION SELECT val21, val22 UNION SELECT val31, val32 etc.
    I don't think this will be significantly faster for large collections of data than to just use DBI with a statement handle and placeholders (but YMMV).
    --
    Jeff Boes
    Database Engineer
    Nexcerpt, Inc.
    vox 269.226.9550 ext 24
    fax 269.349.9076
     http://www.nexcerpt.com
    ...Nexcerpt...Connecting People With Expertise
      Thanks for the clarification.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (14)
As of 2014-07-22 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (109 votes), past polls