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

Re: Database input speed question

by chunlou (Curate)
on Jul 31, 2003 at 17:12 UTC ( [id://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.

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://279665]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-28 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found