Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Short answer #1: it depends

Short answer #2: TIMTOWTDI!

When considering database performance there is a wide range of issues to consider. Some of which you may or may not have any control over if you are in a shop that stovepipes responsibility and you have to deal with a DBA for database layout, a Data Architect for table and index layout and a System Administrator who does the system stuff.

Some of the issues are:

  • How the database is layed out in terms of where the data and indexes are layed out in terms of "spindles."
  • How the tables are indexed and how many indexes are involved
  • IO badnwidth of the database server
  • I'm sure I am forgetting something...

As far as speeding up inserts themselves go I have discovered over the years that using bulk import commands that are supplied by the database manufacturer are usually faster than inserts done via code. So if you have lots of data to insert into a table all at once you could write your data from Perl to a file and use the bulk import feature of choice and import it that way.

An example of where I used this was for a major financial firm that I worked for I used to glean the ARP caches from our network devices from a Perl script that "walked" through the devices discovering neighboring devices along the way. This generated 20,000 ethernet address/IP address pairs (or more) that needed to be stored in a table for later analysis. Using normal inserts against an Oracle database took way too long but doing a bulk import took seconds.


Peter @ Berghold . Net

Sieze the cow! Bite the day!

Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

Brewer of Belgian style Ales


In reply to Re: Database input speed question by blue_cowdawg
in thread Database input speed question by jjhorner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-18 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found