Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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.

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-04-25 06:07 GMT
Find Nodes?
    Voting Booth?