I don't knwo what DB you are using, I'm guessing mysql, but things that you ca do are..

- if you know your data won't violate any indexes during insert, drop the indexes first, insert/update, then reapply your indexes. On small data sets, this is pointless, as the index creation does take time, but on large operations, this is faster.
- if your order of sql operations won't affect each other, break it up and do it in parallel. there is a limit to how well this works. creating 100k processes to do 1 insert will be dog slow. breaking it into 2 processes may gain you something.
- transaction + table lock. you guarantee no one is selecting on your tables, thus, you odn't have to worry about row-level locking.

As I said, don't know what DB you are using, and I only know oracle and postgres really well. But those three (update: was 2) things, especially on bulk operations, will gain you something.

Just don't do the first on a hot database, as you'll slow down all operations due to other processees doing other sql operations. :)

Bart: God, Schmod. I want my monkey-man.


In reply to Re: speedy update routine by exussum0
in thread speedy update routine by js1

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.