In some instances you can write much quicker (execution time) code by doing some of the DB work in perl rather than doing it in the DB. The downside of doing it in your code is that your code takes longer to write and is harder to maintain.

For instance, I have on numerous occasions loaded an entire table into a hash and refrenced data in it directly instead of doing a join in the SQL query. This in some cases has helped my program run as much as 20 times faster. This is only appropriate in some situations, such as when your program doesn't have to take into account any changes that might occur in the table in the DB after it was loaded.
I firmly believe that all the data should be stored inside a RDMBS, just that sometimes you can achieve a big performance boost by doing "more work in perl, and less work in SQL".


In reply to Re: Replacing SQL with perl by lhoward
in thread Replacing SQL with perl by marvell

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.