you can get pathological queries that you think should work just fine, but that due to some optimizer decision actually go off the deep end...

Agreed. I think with DB's in particular a sound understanding of how they do their business is very useful. Both in DB design and in writing efficient queries. In fact the number of times that I've heard people say "I dont need to know how DB's work, its a black box" was a motivation for writing this node.

Also this type of understanding has on at least one occasion earned me signifigant brownie points. The Sybase DBA I work with the most, (who is now my boss) once wondered aloud why when dropping a clustered index and rebuilding it didnt always result in the same record ordering. The reason of course was that internally Sybase was using an unstable sort and two records who were key equivelent might be reordered. The fact I was able to explain this to the man that has taught me practically all of the Sybase stuff I know earned me a lot of respect. So sometimes the payoff isnt even in the code domain, but in real life.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi



In reply to Re^2: Bitten by the worst case (or why it pays to know whats inside the black box) by demerphq
in thread Bitten by the worst case (or why it pays to know whats inside the black box) by demerphq

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.