Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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
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
    ...Nexcerpt...Connecting People With Expertise
      Thanks for the clarification.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-04-30 19:48 GMT
Find Nodes?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW

    Results (441 votes). Check out past polls.