But now, do lots of people really use this stuff to a moderate degree of complexity in the real-world, in the production?
I certainly don't. For that matter, I don't usually embed SQL in my code. I prefer to look at a database as a separate service with its own APIs, whether they are implemented as perl with DBI or C with PL/SQL. I feel the data tier should be separately testable and that changes to the database structure should not effect the applications that use it.

By moderate complexity I mean a set of at least 100 or so tables, queries which is up to a screen in length, 5+ joins, and the like.
I feel that if you've got 100 tables, you're likely suffering from bad design. If the schema is not digestible by a single human at a glance, then it's a likely candidate for being broken into multiple co-operative systems.

Similarly, if you're frequently joining over 5 tables, it's probably because you've over-normalized. Normalization is important, but not at the expense of performance and understandability.

There are exceptions: Sequencing over archive tables is a good use of many joins/unions. Joining over many static lookup tables (int -> string) is probably not a good idea - likely you want to fetch and cache the lookup tables to hashes on the client; it's cheaper to send INTs to the client for the main queries.

I have no problem with complicated queries, but I often find that they're mostly unnecessary and/or performance killers. If you treat the database as an API you can layer a minimal amount of code around the database to implement the API. Treated as a separate entity that API is free to implement appropriate caching and replication semantics where they're most useful.

-David


In reply to Re^3: LINQ/Ambition for Perl? by erroneousBollock
in thread LINQ/Ambition for Perl? by Anonymous Monk

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.