Slashdot Mirror


SQL, XML, and the Relational Database Model

Kardamon writes "In an article on DBAzine, Fabian Pascal writes that SQL is not a good representation of the relational model, and is afraid the situation will get worse with XML and XQUERY. An overview of some of the reactions on the positions Pascal and also C.J. Date take on this issue is given in this article over at SearchDatabase.com by Sara Cushman."

115 of 453 comments (clear)

  1. Isn't XML semi-object oriented? by Neil+Blender · · Score: 2, Insightful

    Of course XML is going to be hard to represent in a relational database. Unless your tables are ( id, object text) and you pull out your XML and parse it.

    1. Re:Isn't XML semi-object oriented? by Bitsy+Boffin · · Score: 4, Informative

      No.

      XML is a file format, it has nothing to do with objects, no more than HTML does, which is not at all.

      However to counter your claim that XML is hard to represent in a relational database. Uhm. No, it's not.

      XML consists (simplifying) of elements and attributes, elements may be nested.

      A generic mapping to a relational database is that elements correspond to the entity tables, attributes correspond to columns in those tables, and the nesting of elements is modelled as a foreign key in the child entity records.

      Whats so hard?

      --
      NZ Electronics Enthusiasts: Check out my Trade Me Listings
    2. Re:Isn't XML semi-object oriented? by AKAImBatman · · Score: 3, Informative

      Whats so hard?

      The "arbitrary XML" part. You must have existing mappings set up to process the XML. New forms of XML thus require a great deal of work on the part of the DB developer.

      XML databases such as Xindice OTOH, allow you to create a table and insert XML in whatever format you chose. XPATH queries take a bit of getting used to, but you can query on tags, attributes, CDATA, or whatever else you chose at whatever level in the XML hierarchy you choose. Thus I can query for the list of addresses for all records that have a firstname attribute that is LIKE "Bob". Or I can dive down to the individual address level and query for all records that have an address of "Drury Lane" (important for tracking down the Muffin Man when you need a giant gingerbread cookie).

      It's not like you can't do this stuff with SQL databases, it's simply a different method of accomplishing the task. Depending on the data you're working with, an XML database may very well be a more efficient method of storage and queries.

    3. Re:Isn't XML semi-object oriented? by Black+Perl · · Score: 2, Informative

      Of course XML is going to be hard to represent in a relational database. Unless your tables are ( id, object text) and you pull out your XML and parse it.

      This is completely false. If you had RTFA, it is mentioned that the relational model can represent hierarchies (and thus XML) just fine. It is SQL that is deficient for this purpose.

      Also, it makes no sense to call XML "object-oriented," which is a programming language term[semi-OO? LOL]. XML is a syntactic hierarchy that can be used to represent "objects", just as it can be used to represent other types of data.

      Last, just about every major database now supports XML as a native datatype, meaning you don't have to pull out XML documents and parse them.

      --
      bp
    4. Re:Isn't XML semi-object oriented? by Doctor+Faustus · · Score: 4, Interesting

      Of course XML is going to be hard to represent in a relational database.

      Generic XML, sure, but you can always layout your XML in a relational style, like this:

      <root>
      <Table1>
      <Table1Row Table1RowID="1"/>
      <Table1Row Table1RowID="2"/>
      </Table1>
      <Table2>
      <Table2Row Table2RowID="1" Table1RowID="1"/>
      <Table2Row Table2RowID="2" Table1RowID="1"/>
      </Table1>
      </root>

      Join support would be nice for simple jobs, but this works really well for more complicated jobs in XSLT. You can use a for-each on "/root/Table2/Table2Row", calling a template and drill down to "/root/Table1/Table1Row[@Table1RowID='$Table1ID'] within the template. This lets you use whatever hierarchy you want, rather than being stuck with the one hierarchy the original designer chose. Just like real relational databases.

    5. Re:Isn't XML semi-object oriented? by MojoRilla · · Score: 4, Insightful

      Try to model anything moderately complex with XML, where things have many to many relationships with each-other. Nesting becomes impossible.

    6. Re:Isn't XML semi-object oriented? by Tassach · · Score: 2, Informative
      but I WILL point out, in regards to objects, us in the modern day have a field type cald BLOB (Binary large object)/blockquote And I will point out that BLOBs are, for all practical purposes, unusable from within the database. While you can store and retrieve BLOBs from SQL, that's about all you can do with them -- anything more elaborate has to be done outside of the database.
      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
    7. Re:Isn't XML semi-object oriented? by tcopeland · · Score: 2, Interesting
      > XPATH queries take a bit of getting
      > used to, but you can query on

      Right on. Another nice thing about XPath is that it can be mapped onto other hierarchical structures. For example, the Java static analysis utility PMD uses XPath to query Java source code for problems. This XPath query checks for empty if statements:
      //IfStatement/Statement/Block[count(*) = 0]
      Good stuff; more XPath rules are here. Props to the Jaxen and SaxPath guys for their fine work!
    8. Re:Isn't XML semi-object oriented? by yintercept · · Score: 5, Insightful
      One does not know whether to laugh or cry. It has been quite obvious that the designers of SQL had little understanding of data fundamentals in general, and the relational model in particular

      This quote needs to be placed toward the beginning of the Grand Encyclopedia of Intellectual Arrogance. Let's see, you have flat tables with a defined primary key and you form relations between these flat tables.

      I do agree that SQL is not the best possible query language, but it succeeds where the other languages fail, it is easy for people to grasp and manipulate. Likewise, HTML has many faults. Plain HTML is still the preferred choice of most web designers because it is easy to learn and write.

      Personally, I think the primary intellectual impulse is to add convolution to simple processes. There will never be an end to the stream of blither about how nulls cannot exist, and anyone who simply uses an sequence counter as a primary key is the devil incarnate. HTML and SQL have two things that almost all the stuff coming from arrogant snits like this author lack. They were designed by people who were actually doing stuff.

      This quote needs a position in the library of intellectual arrogance as well:

      Indeed, data/information management requires "some organizing principle"; that is, structure; anything "unstructured" -- and many in the industry promote XML for that purpose -- is not data, but meaningless random noise that carries no information.

      A snit crassly dismisses several millenia of literature because it is unstructured.

      Quite frankly, meaning and structure are independent of each other. It is possible to find meaning in things with radically different structures. It is true that there is a correlation between structure and the ability to communicate meaning, but a healthy mind can find meanings in things that have not been normalized.

      Likewise, you can have meaningless garbage in relational databases. A case in point is the large number of fake web sites that do things like join the FIPS database to product names so that they can have millions of pages that show up in search engines. Likewise, we see academician filling volume after volume of publications with meaningless tripe.

    9. Re:Isn't XML semi-object oriented? by pacc · · Score: 2, Interesting

      Sure, this is a nice syntax to describe one-off problem. Though for a database you'd hope that it is done once to transform it to something useful instead of 100 times per second.



      //*[@color = "Red"] is taken as a good example in your sense but is actually the worst case in the article. A database would hopefully aleady have track of "red things" and shouldn't have to traverse a tree full of other useless data. Multiple trees spanning the same data is only a contradiction in XML.



    10. Re:Isn't XML semi-object oriented? by mcc · · Score: 2, Interesting

      The "arbitrary XML" part. You must have existing mappings set up to process the XML. New forms of XML thus require a great deal of work on the part of the DB developer

      Um... I haven't read this article yet, but to respond to your comment.. um, no, not really. Here's a trivial possible setup to describe an arbitrary xml tree:

      Table tagname: int tagname_id, varchar name
      Table attrname: int attrname_id, varchar name
      Table tag: int tag_id, tagname_id tagname, tag_id parent
      Table attr: attrname_id attrname, varchar value, tag_id parent

      What's so hard about that? I mean, given, you'd have to do a little bit more work to describe non-tag data or attributes with types other than string. You'd need an "order" column on the tag table if order of xml elements is significant. And it would kind of suck to get too much data out of this with SQL, you'd need either a rather large join or a big flurry of small sql selects (I assume that's what the article has to do with). But the relational model holds up just fine here. I mean, really, XML is just tagged heirarchal data, nothing that special...

    11. Re:Isn't XML semi-object oriented? by halaloszto · · Score: 2, Insightful

      Would you please enlighten me on how an XSLT job operating on a structure like above and showing all the employees who have a salary over 100k, having more than 20 directs and have travelled in the past 12 months look like? Also please include their manages names and phone numbers int he result. And what performance it would have? me

    12. Re:Isn't XML semi-object oriented? by AKAImBatman · · Score: 2, Interesting

      A database would hopefully aleady have track of "red things" and shouldn't have to traverse a tree full of other useless data.

      In fact, that's exactly what a good XML database will do. By indexing all the accessible fields, it's able to provide fast access to database wide queries like the one you suggested. Of course, these indexes do come at a cost of disk space and memory, so not everything is quite rosy in Denmark. :-( The upshot is that with processing and storage power at all time highs many (most?) databases have no need to concern themselves with running out of storage resources. More than enough resources for a multi-gigabyte database exist on even the smallest modern PC.

    13. Re:Isn't XML semi-object oriented? by AKAImBatman · · Score: 3, Insightful

      Ok, so you break down the XML by its structure. Now how do you do a valid query on it? Since you've completely dereferenced its structure and stuck it in a relational model, you've cut yourself off from the prospect of doing XPATH type queries. Instead, you'll need to make multiple (perhaps hundreds?) of passes at the table to reconstruct its data structure. XMLDBs don't have this problem. They deal with the XML in its natural form and are thus able to index, order, and query in that fashion.

      As I said before, you can do many of the same things with an SQL database as you can with an XML database. That's not the point. The point is working with the data in a form that is natural to it and will provide the best results.

    14. Re:Isn't XML semi-object oriented? by shelterit · · Score: 2, Interesting

      Actually, many such things exist, RDF and Topic Maps XTM (http://shelter.nu/art-007.html) being two popular ones.

      --
      -- Home, James - it doesn't matter where that thing has b
    15. Re:Isn't XML semi-object oriented? by Doctor+Faustus · · Score: 4, Informative

      Would you please enlighten me on how an XSLT job operating on a structure like above and showing all the employees who have a salary over 100k, having more than 20 directs and have travelled in the past 12 months look like? Also please include their manages names and phone numbers int he result. And what performance it would have?

      It sounds like you're kidding (or being sarcastic), and I'm not going to debug it (I'd need data, anyway.), but probably something like this:

      <xsl:template match="/root/Employees/Employee[@Salary&gt;100000] " >
      <xsl:variable name="EmployeeID" select="@EmployeeID" />
      <xsl:variable name="NumReports" select="count(/root/Employees/Employee[@ManagerID = $EmployeeID])" />

      <!--
      XSLT sucks with dates, no matter what your data is arranged like. Storing dates as YYYYMMDD does
      at least allow for comparisons. Also, there is no facility that I know of to retrieve the current
      date, so I'm going to hard-code that.
      -->
      <xsl:variable name="RecentTravel" select="boolean(/root/Trips/Trip[@EmployeeID = $EmployeeID and @Date&gt;=20030628 ])" />

      <xsl:if test="$RecentTravel and ($NumReports&gt;20)" >
      <xsl:variable name="ManagerID" select="@ManagerID" />
      <xsl:text>
      Name: <xsl:value-of select="@Name" />, Phone #<xsl:value-of select="@PhoneNumber" />,
      Manager Name: <xsl:value-of select="/root/Employees/Employee[@EmployeeID = $ManagerID]/@Name" />
      </xsl:text>
      </xsl:if>

      </xsl:template>

      And this approach seems to perform just fine in MSXSL, which I believe is DOM-based. It might give a SAX-based engine problems, because it jumps around so much.

      Lest I give a false impression, I'm not suggesting that this sort of XML replace relational databases. The point is that a roughly relational layout is still a good approach, even when you need to be working in XML.

    16. Re:Isn't XML semi-object oriented? by rycamor · · Score: 2, Interesting

      Thank you... yes. While Fabian Pascal may be arrogant at times, that is just a personal thing. What he says should be evaluated for whether it is true, not whether it is arrogant.

      And yes, the relational model is indeed *much* more than just flat tables with keyed relationships. I thought this upon my first encouters with the relational model, but after actually studying the concepts, I realized that there is in fact something much deeper going on, and that it has a conceptual integrity that I only wish could exist in the most of the rest of computing.

    17. Re:Isn't XML semi-object oriented? by dcam · · Score: 2, Interesting

      Hmmm. You make some very good points. I may have to revise my position on XML databases. Indexing may certainly solve some of parsing problems inherent in XML, although this is likely to have other side effects. The database would need to maintain an internal index on each record/row/whatever, which might well add to the size of the database. I'm just thinking aloud here.

      I also see the benefit of the flexibility of XML. Black boxes objects and all that. For example when you reach a user object, just pass in the contents of the tag to some sort of class factory (or an equivalent mechanism). As more information is added only the user object needs to change.

      Arguably performance problems with XML may drop as more and more people implement systems using XML, something similar happened for RDBMSes, so long as there isn't some feature of XML that is inherent in its design that makes it perform poorly. Your comment on indexing counters what I believed was an XML performance killer.

      Thanks for the comments, this has given me quite a bit to chew over. I think I need to do some further research on this and work it through.

      --
      meh
    18. Re:Isn't XML semi-object oriented? by LoztInSpace · · Score: 2, Informative

      I think that document refers to new (connect by features) rather than (new connect by) features.
      I've been happily using it on version 8. The connect_by_root & sys_connect or whatever it is may well be introduced in 10g. Certainly I could have killed for the ORDER SIBLINGS BY clause in 8 but it's only available in 9i+.

    19. Re:Isn't XML semi-object oriented? by leomekenkamp · · Score: 2, Insightful
      (...)is not data, but meaningless random noise that carries no information.
      A snit crassly dismisses several millenia of literature because it is unstructured.

      He was not talking about 'data for human consumption', but rather 'data for machine consumption'. As far as a machine is concerned, all literature carries no information, because a machine cannot extrapolate meaning from it like humans can.

      --
      Wenn ist das Nunstueck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.
    20. Re:Isn't XML semi-object oriented? by AKAImBatman · · Score: 3, Insightful

      "In fact, that's exactly what a good XML database will do. By indexing all the accessible fields"

      In other words, it pretends to be a ralational database.


      What is it with people lately? Everyone seems to want a piece of the trolling action?

      For your information, a set of indexes no more makes a relational database than being in a garage makes you a car. Index data structures are an inherent way to improve the performance of all databases, whether they be ISAM, Hiearchical, Object, or Relational.

      What makes a relational database relational is the way that the data is loosely intertwined to develop logical connections. In theory, these connections can complete various thoughts about a piece of data. ISAM files are merely indexed data, while Hierarchical (including XML) databases contain a complete "data packet" covering a particular concept. (e.g. Customer contains name, a set of addresses, and a set of phone numbers.)

  2. "NULLS are bad." quote by MattRog · · Score: 5, Informative

    Celko is misquoting Darwin in saying that "The idea that you will always know everything is arrogant".

    Date/Darwin/Pascal propose that you codify what you don't know (so to speak). Read their proposed solution here:
    http://www.hughdarwen.freeola.com/TheThirdManifest o.web/Missing-info-without-nulls.pdf

    And yes, XML DBMS are a throwback to IBM IMS and other hierarchical DBMS products. Anyone who has ever used a hierarchical DBMS will tell you that there are some pretty non-trivial problems that you cannot work around due to their hierarchical data model, yet XML DBMS proponents propose we go back to that old, inflexible system!

    --

    Thanks,
    --
    Matt
    1. Re:"NULLS are bad." quote by MattRog · · Score: 5, Interesting
      To those not "in the know" here's some further clarification:
      "The use of the terms "flat tables" or "2D tables" to describe data stored in a relational database is wrong, he added."

      Basically what I take from this is that the table (e.g. SELECT * FROM foo) is simply a convenient logical representation of a stored relation. That is to say, foo can be implemented by the DBMS as a linked list, a tree, any data structure. The problem is that current SQL DBMS products do NOT do this and so we have the associated performance problems with normalized schemas. If the DBMS was truly a RDBMS then it could optimize the physical storage to improve performance.
      When asked if the relational model was implemented soundly in today's systems, Craig Mullins' instant reply was "no," but he doesn't think the situation is as bad as Date says it is.
      "We're doing production work and delivering value," Mullins said. "Isn't that what it is all about?"

      The question is not "Are current SQL systems providing value" because certainly they are. They overthrew the hierarchic DBMS products for good reason - they were better. The real question is "Are the current SQL systems providing all the value they can". One can simply look at the wide array of DBMS offshoot products like XML DBMS, so-called "Multivalued DBMS" etc. to know that there are significant limitations of SQL products - ones which Date/Pascal/Darwin stress are not limitations of the Relational Model but merely these SQL products. To put words in their mouth, but I don't think they'd disagree at my summation, they'd suggest that if someone were to implement a Truly Relational Database Management System that these other products would quickly become obsolete.

      --

      Thanks,
      --
      Matt
    2. Re:"NULLS are bad." quote by Yosi · · Score: 2, Informative

      At least some XML people recognize the same, thus the existence of RDF.
      RDF is equivilent to a relational database. There is a working group right now looking into a query language for RDF.

      That said, some RDF people here at the w3c don't care that much for serializing RDF as XML, prefering the much more readable n3

    3. Re:"NULLS are bad." quote by Chops · · Score: 4, Insightful
      While you're at it, check out this tripe (from the article):

      The relational model is predicate logic applied to databases. Predicate logic is the real-world's two-valued logic (true/false) ... logic guarantees correctness -- defined as consistency -- of query results. It is to preserve logical correctness, therefore, that Codd's Information Principle requires that all information in relational databases be represented as values in relations. The term "NULL values" suggests that Chamberlin does not realize that part of the problem with NULLs is that they are not values -- indeed, they are supposed to be markers for the absence of values. Whatever a database table with NULLs is, neither is it a relation, nor do NULLs represent anything in the real world and, consequently, correctness and the rest of the relational benefits are lost.

      Incidentally, "inapplicable values" are a red herring. They are an artifact of bad database design. There is only one kind of missing value -- unknown -- and as I demonstrate in the above-mentioned chapter, it can be handled relationally, without the huge problems of SQL's NULLs.


      I read this and pretty much gave up getting anything of value out of this article -- I hadn't understood much that went before it, though my distrust of all things XML had led me to believe this guy might know what he's talking about.

      If you removed NULLs from relational database design, people would reinvent them (poorly) -- probably by using IDs of -1 or 0, or IDs to a special magic "null" row, which I suspect is what he's talking about by "it can be handled relationally." To suggest that missing or inapplicable values are not part of "the real world" is so wrong it's... well... wrong. Anyone who's actually done database work (or programming work, for that matter) knows this.
    4. Re:"NULLS are bad." quote by RatRagout · · Score: 3, Informative

      The S in SQL points to the fact that the Query Language is structured...not the data...

    5. Re:"NULLS are bad." quote by ceswiedler · · Score: 2, Insightful

      SQL NULLs are the worst thing since unslicable bread. They break boolean logic. You would think that if (X = Y) is false, then (X != Y) would be true. With SQL, if either X or Y or both are NULL, then any expression evaluating it is false.

      I understand the argument (NULL indicates no data--so you can't claim it's equal to anything). Academic bullshit. Anyone who's maintained code using SQL NULL semantics will agree. If you really want to claim that NULL is so much 'not a value' that you can't compare it to anything, then do it the man's way and throw a goddamn exception. Of course, anyone can see that doing so would make code which MIGHT encounter a null value even MORE difficult to maintain, so they came up with this 'any comparison to NULL is false' crap.

      The easiest way to define NULL is that it's equal to another NULL value, but not equal to anything else. Then I don't need any special 'is null' clause either.

      The very definition of b0rken.

    6. Re:"NULLS are bad." quote by MattRog · · Score: 2, Interesting

      I'm not quite sure what you're getting at but if you've read his work he's never saying that the concept of a missing attribute is "bad" just that the "NULL" method of representing it as such is. He proposes several different methods in his book which I think I mentioned somewhere else.

      If you're interested, it's Chapter 10 - "What You Don't Know Can Hurt You: Missing Information". Take a look at it for a more precise definition.

      --

      Thanks,
      --
      Matt
    7. Re:"NULLS are bad." quote by gfody · · Score: 2, Insightful

      nulls shouldn't be used in the case where this behavior would be unwanted. a null isn't a blank value, it's a missing value. implementing a missing value relationaly would mean absence of a reference (the null is the result of a left outer join or simply isn't returned).

      --

      bite my glorious golden ass.
    8. Re:"NULLS are bad." quote by CoughDropAddict · · Score: 2, Insightful

      I cannot think of a situation where I would want NULL=NULL to be true. I'm no SQL guru and I'm a bit rusty, but:

      1. the only situation I can think of where you are comparing two values, where neither is a literal, is when you are joining on a pair of columns

      2. if one of the values *is* a literal, there is no reason not to write "IS NULL" instead of "=NULL"

      3. if you *are* joining on a pair of columns, letting "NULL=NULL" would not make any sense (you would get the cartesian product of all rows from both tables that have NULL in those columns)

      4. also, if you are joining on a pair of columns, one of those should be a primary key, and you shouldn't have NULL values in a primary key column.

      Can you illustrate a situation where you want NULL=NULL to be true? Perhaps the situation arises in procedural SQL (stored procedures and such) that I am not as familar with.

    9. Re:"NULLS are bad." quote by tsarin · · Score: 2, Insightful
      With SQL, if either X or Y or both are NULL, then any expression evaluating it is false.
      Actually, if if any members of the set (X, Y) are NULL, any comparison involving those members evaluates to NULL, not false.

      The easiest way to define NULL is that it's equal to another NULL value, but not equal to anything else. Then I don't need any special 'is null' clause either.
      No, the easiest way to define NULL is that you don't know what it is; it's unknown. It can't be equal, not equal, whatever to anything, even another NULL, for that very reason.

      An example: I'm thinking of a number. Tell me, is it greater than 13? Unknown. Less? Unknown. &c. Try

      select (NULL = NULL)::boolean;
      (PostgreSQL syntax; substitute however it works for your favorite [O]RDBMS). If it's not brain-damaged, you'll get NULL. (Even MS SQL gets this one right, folks.)

      The very definition of "b0rken" is people railing -- incorrectly, even -- against something they don't understand. The very definition of irony is when the thing in question is SQL NULL.

    10. Re:"NULLS are bad." quote by kcbrown · · Score: 2, Interesting
      SQL NULLs are the worst thing since unslicable bread. They break boolean logic. You would think that if (X = Y) is false, then (X != Y) would be true. With SQL, if either X or Y or both are NULL, then any expression evaluating it is false.

      No wonder you think SQL NULLs are the worst thing -- you can't even get the semantics right.

      When either X or Y (or both) are NULL, then any expression evaluating it is NULL. Not false. Not true. NULL. Any SQL implementation that behaves differently is broken.

      It's not the SQL standard's fault if your code's logic can't handle that case. Nor is it the standard's fault that you can't see fit to NOT USE the NULL feature when you don't want to (and any reasonable database even goes so far as to give you the option of making *sure* you don't use it -- that's what the NOT NULL declaration when defining a column is for).

      Getting rid of NULL isn't going to help you when you suddenly discover that you really DO need to be able to represent "missing data" somehow.

      --
      Use 'slashdot stuff' in the subject line in any email you send me if you want to get past the spam filter.
    11. Re:"NULLS are bad." quote by Tony-A · · Score: 2, Insightful

      They simply believe that "nulls" are a hack around the real need of supporting full value domains.

      Thanks, makes sense.
      However, the required complexity required to handle "the real need of supporting full value domains" has to be sufficient to handle all possible reasons and scenarios where you do not have a simple value. You might get close with a Lisp back-end, but this is heading too much like needing a supercomputer to hand one number in an el-cheapo caculator.

      Nulls are a hack. A nice simple hack. It is possible to build bigger and more complicated hacks and take things a wee bit further, but the further the screwier I'd expect.

    12. Re:"NULLS are bad." quote by doom · · Score: 2, Insightful
      Date/Darwin/Pascal propose that you codify what you don't know (so to speak). Read their proposed solution here:
      Well, I read it and essentially what they're saying is that instead of having a single NULL that means "we don't have the info and we don't know why", they recommend having lots of single column tables pointing at the missing values, one table for each reason/excuse. So instead of having NULLs in the salary field, you've got tables that explain "No salary because the guy is on commision", "No salary because the guy is unemployed", "No salary because it is regarded as confidential", and so on.

      What strikes me about this notion (outside of it's general clunkiness) is that it seems to assume that you will always know why you don't know. In reality, I think systems like this would sprout lots of tables called "unknown_value_for_unknown_reasons".

    13. Re:"NULLS are bad." quote by Wastl · · Score: 2, Insightful
      Basically what I take from this is that the table (e.g. SELECT * FROM foo) is simply a convenient logical representation of a stored relation. That is to say, foo can be implemented by the DBMS as a linked list, a tree, any data structure.

      True. However, this encoding is usually very inconvenient (consider representing an HTML document or a structured piece of literature in this manner).

      Besides this, nested structures are at least as logical as flat structures (I continue to call them flat because they *are*). Relational database logic is merely a fragment of first order predicate logic, one that is restricted to - guess what - flat relations, whereas first order predicate logic usually works with *nested* structures (called terms) and relations. XML and other nested data structures fit very well into logic, and in fact we (a research group in Munich and some other places) are working on a logic-based query language that exploits this similarity.

      I agree with many of the statements that the author of the article makes, in particular regarding XQuery. However, some are so arrogant and *unproven* that it leaves the article in a bad light. Also, while he claims to have a good insight into database theory, I don't think he really has. SQLs big advantages are (1) it is easy to use and (2) it has a very limited expressive power which makes it easy to implement and efficient to evaluate. Other approaches have been considered, e.g. in deductive databases or knowledge base systems. However, those needed languages that were basically Turing complete or at least supported basic recursion (to implement transitive closure) and thus could lead to very inefficient queries.

      Sebastian

  3. 'scuse my ignorance but... by fiannaFailMan · · Score: 4, Interesting
    It has been quite obvious that the designers of SQL had little understanding of data fundamentals in general, and the relational model in particular; and SQL was hardly developed in accordance with good language design principles.
    What exactly is the problem with SQL?
    --
    Drill baby drill - on Mars
    1. Re:'scuse my ignorance but... by XMyth · · Score: 5, Funny

      Well, all the apps which are backed by SQL databases are crashing all over the place. After its several years in the field now SQL has been proven to be unstable, unreliable, and completely incapable of doing the job.

      Evidence of this is in the hundreds of companies who are completely unable to maintain a database of any significant size despite vendor claims to the contrary. Also, note the thousands of websites which routinely fail due to random database problems. It appears that all SQL products are sad implementations of a horrible standard which simply does not cut it .

      (the above is intended entire as sarcasm)

    2. Re:'scuse my ignorance but... by afidel · · Score: 5, Insightful

      The problem with standards is their's so many to choose from. Or in the case of SQL every vendor seems to think that the standardized language is inadequate and yet they make no roads towards improving the standard. This leads to every vendor having their own superset of the language which makes maintainability in cross database projects exceedingly difficult and migration in applications that aren't designed for it incredibly difficult. As to fundamental flaws in the concepts around SQL I have yet to hear a concrete argument against it, mostly vague rantings from people who's ideas weren't chosen by the marketplace to serve real world needs.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    3. Re:'scuse my ignorance but... by Doesn't_Comment_Code · · Score: 2, Funny

      Oh... I was all ready to thrash you, with my mouse over the reply button and everything. Then I got to that last line about how your entire post was sarcasm.

      Whew...

      --

      Slashdot Syndrome: the sudden, extreme urge to correct someone in order to validate one's self.
    4. Re:'scuse my ignorance but... by Tarantolato · · Score: 4, Insightful

      One problem is that as a language it lacks elegance and is awkward to build large queries in. More deeply smug relational weenies insist that it does not properly model the relational algebra model pioneered by Ted Codd.

      I'm not sufficiently versed in database theory to understand the technical side, but SQL certainly does feel to me like a non-optimal solution.

    5. Re:'scuse my ignorance but... by tanguyr · · Score: 5, Insightful

      What exactly is the problem with SQL?

      Wouldn't call it a problem, but there just seems to be something about it that drives all the Oo fanboys up the wall - maybe it's the fact that they can't make nice UML diagrams of a query or something.

      There nothing wrong with SQL and RDBMS - they've been around for years and they'll be around for years to come. I have this argument each and every day at work with people who seem to think that the solution to (hypothetical) "database bottlenecks" is to bury everything in a quarter of a million lines of EJB code and invest a king's ransom in application server licenses to run it on. Don't get me wrong: i've seen some real horrorshow coding with SQL mixed into code, but a bad coder will produce bad code in any language. Until then, SQL works. What more can you say?

      --
      #!/usr/bin/english
    6. Re:'scuse my ignorance but... by MattRog · · Score: 5, Informative

      There are a couple of "problems" that they have identified:
      1) You can write a given query and number of different ways. This is not necessarily a SQL problem but due to this the query optimizers have to be enormously complex to handle complicated queries and by association you can have queries which describes two identical sets but have vastly different runtimes/costs.
      2) Little/No support for relational domains (e.g. complex data types)
      3) Non-updateable views (partially due to duplicate handling and/or allowing relations with no primary key)
      4) Weak support for complex integrity constraints (e.g. business rules)
      5) No support for entity sub/supertype relationships
      6) Supports NULLs (Date/Pascal/Darwin do not like NULLs)

      Try searching www.dbdebunk.com for SQL. Or pick up the great book "Practical Issues in Database Management" by Fabian Pascal.

      --

      Thanks,
      --
      Matt
    7. Re:'scuse my ignorance but... by Xentax · · Score: 4, Insightful

      No kidding. This sounds like Andy griping that Linus' "school project" is an inferior kernel.

      Sounds like a semantic argument to me; where the Rubber Meets The Road, Linux is the kernel of a variety of widely used, production-quality OS's, while Minix is an academic *model* (on purpose, to be sure, but a *model* rather than a useable-on-a-daily-basis kernel, nevertheless). Similary, claiming SQL is crappy for various academic/theoretical reasons doesn't change the fact that it's in wide use today, as a concrete solution to any number of million- and billion-dollar abstract problems.

      So, if SQL is so bad, maybe they should stop cursing the darkness, and show us the light. In the meantime, people will use (and incrementally) improve the tools at hand to solve the problems at hand.

      Right now, SQL-based database solutions are generally the best solutions for *real* data problems that we have to solve, from mySQL-driven personal webpages, to enterprise-grade databases powering major websites, business-to-business e-commerce, and everything in between.

      Invent a better mousetrap, and the world will beat a path to your door. Criticizing the mousetrap as an inferior pest control device doesn't do much to keep the mice out...

      Xentax

      --
      You shouldn't verb words.
    8. Re:'scuse my ignorance but... by sql*kitten · · Score: 5, Insightful
      there just seems to be something about it that drives all the Oo fanboys up the wall

      Yeah, I know what you mean. These kids can't wrap their tiny minds around the following concepts:
      • A table is not a class
      • A row is not an object
      • A column is not a property

      Whenever I see a project gone horribly wrong, and the language is C++ or Java, the problem usually is the system architect didn't grok the above statements. They should be tattooed onto the forehead of every OO programmer, so when they're "pair programming" they can read it off each other.

      solution to (hypothetical) "database bottlenecks" is to bury everything in a quarter of a million lines of EJB code

      I get that too - then I show 'em the logs that show the database processor is mostly idle as it waits for their application to either request more data or finish working on what it's got!
    9. Re:'scuse my ignorance but... by tanguyr · · Score: 4, Funny

      I get that too - then I show 'em the logs that show the database processor is mostly idle as it waits for their application to either request more data or finish working on what it's got!

      Here's one that'll make you howl: "sorting is a presentation-tier concern"

      --
      #!/usr/bin/english
    10. Re:'scuse my ignorance but... by LostCluster · · Score: 4, Insightful

      1) You can write a given query and number of different ways. This is not necessarily a SQL problem but due to this the query optimizers have to be enormously complex to handle complicated queries and by association you can have queries which describes two identical sets but have vastly different runtimes/costs.
      Just because two queries return the same results today do not mean that they will continue to do so in the future. If a value that used to be bounded from 1 to 10 suddenly is declared to be allowed to be cranked to 11, then suddenly "equal or greater than 9" and "equal to 9 or equal to 10" will have gone from always returning the same results to now specifying different sets. Clearly, the more specific code will execute faster, but if an assumed boundry no longer holds in the future, the program will become obsoleted and require revision to the less specific version. This isn't a language-specific issue, it's just a problem that crops up whenever a computer program encounters a situation its designer wasn't expecting.

      2) Little/No support for relational domains (e.g. complex data types)
      Not a bug, it's a feature. The S in SQL is for "structure"... go hammer out your data into a structured format rather than a complex one and then come back.

      3) Non-updateable views (partially due to duplicate handling and/or allowing relations with no primary key)
      Totals will always be a non-updatable view. You can't change the number of objects you have without creating some new objects or chosing to get rid of some existing objects. Fields in a one-to-many relationship cannot be changed because to do so would be ambigious... do you want to create a new entry in the other table, or do you want to rename an existing entry in the other table. Go do what you meant to do, then refresh your view.

      4) Weak support for complex integrity constraints (e.g. business rules)
      That's more an issue for applications rather than databases. The program or user that's creating the query should know what's allowed by business rules, because if the database is going to refuse a query due to business rule violations, that query shouldn't have been offered to the database in the first place. Those errors should be trapped upstream before they get that far. SQL triggers for business rules should be a last line of defense, not something that should be regularly asked to function.

      5) No support for entity sub/supertype relationships
      Plenty of support, just not intrinsically. Just use a one-to-many relationship in your DB structure and go along your way.

      6) Supports NULLs (Date/Pascal/Darwin do not like NULLs)
      That's like trying to do math without a concept of zero. Sometimes, things just don't apply and we put "N/A" on the form and "NULL" in the database.

    11. Re:'scuse my ignorance but... by Brandybuck · · Score: 2, Interesting

      As a OO fanboy, I must protest your mischaracterizatoin of us. Unlike the DB fanboys, we never claimed that OO is suitable for every problem domain.

      What drives me nuts aobut the DB fanboys is that they have to use DB for everything. For example, I maintain an embedded system where some nitwit ex-web-developer decided to implement the process table with MySQL. Huh?

      DB is suitable when you have massive amounts of uniform data. OO is suitable when you have heterogenous structured data. Often these two areas overlap, so you can choose whichever you prefer. You can even mix the two if you like. But where they don't overlap, stick with the appropriate paradigm.

      --
      Don't blame me, I didn't vote for either of them!
    12. Re:'scuse my ignorance but... by iSwitched · · Score: 2, Insightful

      You seem to have been exposed to some relatively clueless, or at least inexperienced J2EE coders.

      No java guy worth his or her salt thinks that all that EJB code is there to 'work around' database bottlenecks. Anyone with any experience knows that if you want pure perfromance, you let the database do its thing with nice optimized stored procedures in the dbs sql dialect du jour. Of the many reasons for choosing EJB, one is to abstract the database away enough that your application will run against any database, with no re-coding.

      You see, the opposite end of the extreme example you proposed is all those monolithic DB apps I've seem where the data-access AND business logic are tied up in multitudes of stored procedures, creating a porting and upgrading nightmares, should you ever want to change platforms.

      Sure, if you're creating proprietary solutions for internal corporate problem-solving, and you're pretty sure you'll be running on Oracle forever, then go for it.

      If you need multiplatform, databse-agnostic apps, then I've been happy with Java for a while now. ...And as for that Kings Ransom? Might I suggest JBoss or Orion.

      --
      "That naive cube! How long must I suffer this!" --Sheldon J. Plankton
    13. Re:'scuse my ignorance but... by MattRog · · Score: 5, Informative

      "Just because two queries return the same results today do not mean that they will continue to do so in the future."

      Total misunderstanding of what I wrote. To put it another way:
      SQL allows you to write queries which are mathematically equivalent but result in vastly different query plans and performance. Again, not a particularly stinging-indictment of SQL as such but had it been designed differently it could have avoided such ambiguity in the language.

      "Not a bug, it's a feature. The S in SQL is for "structure"... go hammer out your data into a structured format rather than a complex one and then come back."

      So you're saying a tree has no "structure"? That a domain has no structure? If it had no structure, it would be a little difficult for computers to process.

      "View stuff"
      Pascal (or Date, can't remember) provides an iron-clad (mathematical definition) method of creating views which will always be updatable. There are structural deficiencies in SQL which prohibit this. I will not waste time/typing here illustrating them, they are all identified at their web site.

      "SQL triggers" etc.
      It is precisely the reason that applications were enforcing business rules that DBMS were invented all those years ago! There are plenty of reasons that application-enforcement of business rules is a bad thing. Again these are illustrated on their web site. Also, your quote about "SQL triggers" is basically re-stating what I mentioned: that SQL is poor at implementing business rules!

      "Plenty of support, just not intrinsically."
      Which is exactly the same as saying "no support for entity sub/supertypes". Plus, one-to-many tables are not the same, you're thinking of something else. Chapter 6 of Fabian Pascal's book "Practical Issues in Database Management" covers this in some depth.

      "That's like trying to do math without a concept of zero."
      Not quite the same. Remember that the relational model is based upon predicate logic and set theory. Set theory has the empty set, which is not the same as NULL. SQL products currently handle null in a ridiculous manner (some sort NULL oddly, comparison is difficult, summation is odd). Pascal/Date do not suggest that the concept of "unknown" is bad, just that the SQL representation as NULL is.

      --

      Thanks,
      --
      Matt
    14. Re:'scuse my ignorance but... by shirai · · Score: 2, Insightful

      The one bone I have to pick about SQL is there is no standard way of retrieving the value of an Identity, Counter, AutoIncrement (or whatever your database calls it) field after inserting a record. This is brain dead.

      Every SQL dialect has a special, unique way of getting the value in this field. Many (not all) things in SQL can be written to be compatible with virtually every database (if you are very very careful) except this one important thing. I know you can requery the database with all the fields or insert a unique ID manually but this seems like a horrible hack to me.

      --
      Sunny

      Be my Friend

    15. Re:'scuse my ignorance but... by fupeg · · Score: 2, Interesting
      Ch-ching! If I had a nickle for every DBA I've had to deal with who loved to say crap like :
      • If you would let The Database make that calculation, it would be faster.
      • The Database has a feature that can do that for you
      • If you're going to use that programming language, use this extension of it that The Database supports
      • Re-write that query as a stored procedure and it will be so much faster
      DBAs love to lock you into the database. Put more logic there. Use extensions so you're tied to a vendor. Squeeze out the extra millisecond of performance so that you'll have to continue to use Oracle or DB2 forever. Blah blah blah.

      The truth is that these guys want you locked in their product, because they have training on that produce. It's all about job security. These guys hate object-relational techniques because they turn databases into storage/retrieval devices. They REALLY hate simplified databases (especially MySQL) that don't have built-in XQuery support or Java stored procedures or binary content indexing or --INSERT USELESS FEATURE HERE--.

      It's all about job security with these guys. They've always got FUD prepared like
      • You can't rely on that other vendor's database because it will not scale
      • You can't rely on that other vendor's database because it will corrupt your data
      • Don't let developers write DDLs or they will crash the database
      • Moving business logic out of the database will cause huge performance problems
      It never ends...
    16. Re:'scuse my ignorance but... by amorsen · · Score: 2, Interesting
      Recursing through a classic SQL tree with parent-"pointers" is ghastly slow. It gets slightly less slow if you use a stored procedure, but if you do that you have confined yourself to one database vendor. (So much for SQL being a standard.)

      With "modified preorder tree traversal" you can do the whole recursive query, whether up or down, in one non-recursive SQL statement. Very neat, but it is a pain to implement and you better be careful about the atomicity of updates. So far I have not found a way to avoid locking the whole table for writes for some operations, even with databases which do proper transactions. The same algorithm could be implemented cheaply and with more fine-grained locking in the database itself.

      --
      Finally! A year of moderation! Ready for 2019?
    17. Re:'scuse my ignorance but... by Unordained · · Score: 2, Interesting

      Technically, it's not a relational-database concern. Relation variables (tables) aren't sorted, order doesn't matter. Any time your query asks the output to be sorted, it's asking for something extra that isn't appropriate for relations, but -is- appropriate for list/vector/array/what-have-you.

      Yes, it's more efficiently done server-side. But a relational database server could, academically, be a full-blown RDBMS and not have any sorting abilities whatsoever.

    18. Re:'scuse my ignorance but... by D-Cypell · · Score: 3, Insightful

      Here's one that'll make you howl: "sorting is a presentation-tier concern"

      Largely it is. If the user hits a table header to sort on the selected row, are we are supposed go back to the database and do a different 'order by'?... I dont think so!

      If the sort is required purely to provide the user with a list in 'alphabetical' order then sorting in the presentation tier tends to be smarter because it reduces the 'bug-space'. That data generally passes through several levels of indirection, at any time someone may decide to replace an ordered collection with an unordered one and by the time it reaches the screen... it all out of sequence. Also, its very possible that while the data needs to be sorted to give users that 'fuzzy feeling' the same API can be used to provide a SOAP/XML-RPC/CORBA interface that doesnt require sorting (or rather, let the consumer decide). Why do this, fairly expensive, operation on a tier that doesnt always require that it is done?

      If sorting is required in the middle-tier it is usually due to some search algorithm or something. In this case, I prefer to put the sort with the search so that it is clear. Where I have worked with pure SQL (tend to use ORM tools now) I like to put the SQL in a seperate repository that the DBA's can tweak without recompliation. That 'order by' gets dropped pretty quick when the PHB is complaining about DB performance... and WHOOPS... really weird bug in the search code.

      So it seems to me, that when you factor in the real world issues around using the database as a sorting tool.... its not quite so 'howl-worthy'.

    19. Re:'scuse my ignorance but... by D-Cypell · · Score: 2, Interesting

      sorting algorithms in most big databases are highly optimized

      Efficient sorting algorithms are hardly a closely guarded secret, it is possible to implement the exact same 'optimized' algoritm in any of the tiers. With this in mind, the performance costs of the two sorts cancels and you are left with the additional cost of the SQL parser. So assuming the programmer is capable of either A) writing an efficient sort or B) using the efficient sorts provided in the libraries that are supplied with most mainstream languages this option will always be more efficient.

      the cost of ordering a recordset will almost always be minimal compared to the cost of generating that recordset

      Exactly! So request the record set once, load it into memory and do whatever sorts are required. If I need to sort the data on different columns for different reasons the costs of generating the record sets begin to multiply. Maybe the data is in the database cache after the first query, but maybe its not and needs to be regenerated.

      'Order by' has been useful to me in situations where the query is combined with another clause such as one that limits the size of the dataset. Something like 'load the top 10, highest priority bug reports'. If I did this in code I would need to load them all then sort and discard, which is clearly not very bright, but using 'order by' just to sort data has always proved problematic in my experience. YMMV I guess.

      i noticed that the "order by" clause made it into EJBQL 2.0 as well, despite the howls of protests from object purists.

      The howls of the object purists tend to go beyond this and recommend against EJB altogether. Even so, I dont see any reason for not including it in the EJBQL spec, I am sure there are cases where it can be very useful. Its a feature that is provided by the database and not including it 'on principal' would be pretty daft, but using it 'because its there' doesnt constitute a strong argument in my book.

    20. Re:'scuse my ignorance but... by cybergrue · · Score: 2, Interesting
      I've met people who think that joins are best done in the middle tier, on tables with hundreds of thousands of rows!

      Have you run test to confirm that this is false? As part of a project to improve the performance of an app that I developed at work, a colleague and I rewrote several key select statements in different manners, and found the select statements using joins were the fastest by far (in a very large table). We think that the DBA team has the database tuned in such a way to cause this, but I have also heard that there is a query optimizer built into the engine (sybase) that works much beter with joins then nested selects.


      The only advice I can give is to run tests comparing the performance of different SQL statements that do the same thing to determine which is the fastest. The results may surprise you.

    21. Re:'scuse my ignorance but... by TheBracket · · Score: 2, Informative
      Ugh, the lameness filter kept complaining about this!

      That's why sequences (as implemented by PostgreSQL and Oracle) are handy. Simply create a sequence, and call NEXTVAL(sequence_name) to get the identity of the next record. It isn't an autoincrementer (but can be used as one with default values), and you get the advantage of knowing what ID you will use before your insert - very handy for inserting a lot of related data at once. You can also do tricks like having sequences with different increment numbers, different base values, or even concatenate them with a string to get multi-master friendly safe replication.

      For a sequence/nextval to be useful, the increment must be absolutely atomic - that is, it must return the next value and increment without any chance of the same number being given to another caller. Oracle and PostgreSQL do this for you.

      You can simulate these in SQL Server with the following stored procedure (original source here: Sequence table: CREATE TABLE sequences ( -- sequence is a reserved word seq varchar(100) primary key, sequence_id int ); MS SQL Server stored procedure: CREATE PROCEDURE nextval @sequence varchar(100), @sequence_id INT OUTPUT AS -- return an error if sequence does not exist -- so we will know if someone truncates the table set @sequence_id = -1 UPDATE sequences SET @sequence_id = sequence_id = sequence_id + 1 WHERE seq = @sequence RETURN @sequence_id I've used this to great effect in SQL server. I've had to emulate it in Access once (yuck! it worked, though!). I've never tried it in MySQL, but it can probably be done.

      This page (see LAST_INSERT_ID(expr) talks about how to do it in MySQL. I don't use MySQL when I can avoid it; it's a great, fast database for high-read environments without triggers and similar, but I've never seemed to end up working in one of those!

      --
      Lead developer, http://wisptools.net
    22. Re:'scuse my ignorance but... by boomgopher · · Score: 2, Interesting

      "Here's one that'll make you howl: "sorting is a presentation-tier concern"

      Yeah, well when you have to sort String values using oddball locale-specific methods it sure the heck is.

      --
      Your hybrid is not saving the environment. Its purpose is to make you feel good about buying something.
    23. Re:'scuse my ignorance but... by Khazunga · · Score: 2, Interesting
      Largely it is. If the user hits a table header to sort on the selected row, are we are supposed go back to the database and do a different 'order by'?... I dont think so!
      Then think again. It's far from a black and white question. If data transfer between persistence and presentation tier isn't costly, you're better off passing the sort to the database. It may have the data already ordered, either because the a similar query or subquery is cached, or because the database has an index on the sorted column. Moreover, if you're writing the sorting algorithm yourself, rest assured you won't do as good a job as your db vendor, whose code has already been pounded and cleansed by heavy usage.
      --
      If at first you don't succeed, skydiving is not for you
  4. My Two Cents by Doesn't_Comment_Code · · Score: 3, Insightful

    I think relational SQL databases are just fine, easy enough to use, and serve their purpose very well. They DO take some serious thought when designing tables and queries - but we shouldn't be afraid to think. If your head hurts from SQL, keep on it for a couple more minutes and you'll probably have it! If your head hurts from SQL, you've tried thinking about it - and you still don't get it - you're probably in the wrong business. Complex information retrieval is complicated and sometimes difficult to understand.

    On to the next part. XML serves its purpose very well. Although I wouldn't consider XML and SQL to serve the same problem sets equally well. There are certain situations where SQL is perfect. And there are other situations where XML is preferable. If you think of the two as two sides of the same coin, I think you're making a mistake. Likewise, you can't just flip between the two on a whim. Choose the format that's most suited to what you want to do and go forward.

    It aint broke and don't need fixin'

    --

    Slashdot Syndrome: the sudden, extreme urge to correct someone in order to validate one's self.
    1. Re:My Two Cents by Doesn't_Comment_Code · · Score: 2, Interesting

      I've used Oracle and MS SQL Server in environments ranging from web sites to enterprise apps. The biggest problems I've seen are not usually problems with these DBMS; they are problems with the application.

      I've mainly used MySQL for my large projects, and like you, those projects have not had more than several million entries. But my experience with SQL has been wonderful. I have spent several hours pounding my head on a desk trying to understand why something did or didn't work. But all my applications have run as smoothely and as quickly as one can expect.


      I think XML is a step backward, if you're using it to replace a SQL Server database.
      I agree - provided your application is best suited for SQL to begin with. There are some small problems where flexibility (XML) is more important than the great features SQL has to offer. I can't see a large number of XML databases at the core of huge operations though.

      --

      Slashdot Syndrome: the sudden, extreme urge to correct someone in order to validate one's self.
  5. Link to history of SQL.. by MisanthropicProgram · · Score: 5, Informative

    Here is a history of SQL. I wanted to check the article's facts. Also, I was curious... History of SQL

  6. Ignores the good points of SQL by b0lt · · Score: 3, Insightful

    Easy to use, easy to debug, easy to understand, powerful. Isn't this good enough?

    --
    got sig?
  7. SQL sucks? by localman · · Score: 5, Insightful

    From the article:

    It has been quite obvious that the designers of SQL had little understanding of data fundamentals in general, and the relational model in particular

    Gimme a break. Love it or hate it, SQL is an amazingly powerful way to work with arbitrarily complex data sets. Need proof? It is the backbone of nearly every non-toy scale data storage project. No amount of psuedo-academic argument can make irrellavent the fact that it works.

    Everybody goes through a phase where they bitch about SQL. So did I. And I built a clever OO DataModel module that abstracted it into pretty heirarchies and all sorts of clever crap. Then I tried actually building systems with it and realized I was better off with ugly ol' SQL.

    I've been part of too many projects where people pulled out the UML books in favor of a decent First Normal Form DB design and led the team down the tubes.

    I'm not saying these other methods don't have their place -- they do. But they aren't going to displace SQL because it has it's place also. And it's place isn't theoretical, it's been practically demonstrated a million times.

    Cheers.

    1. Re:SQL sucks? by kpharmer · · Score: 5, Insightful

      Keep in mind that Fabian Pascal is generally considered a crackpot purist. He's been insisting for years that there is no such thing as a relational database product - since none implement a purely relational model.

      However, he hasn't delivered an exaple of one, he hasn't clearly articulated the differences between his vision and the commercial options, and he apparently refuses to acknowledge that some problems in life fail to fit well into the relational model (hierarchies, networks, inheritance, etc).

      Much of what he, Celko, and Date complained about were actually responses by vendors to adapt to the real world. They were somewhat successful - and now SQL can be used successfully to solve a far greater set of problems than Pascal has ever admitted exist.

      A perfect example of this nonsense is there insistence that good indexing in a 3NF model outperforms denormalized data in a star schema. Sounds great, absolutely doesn't work. Across eighteen years working with relational databases I've never seen their suggestions work. Of course they have a response to this - the vendors should just "make the databases faster" - like it's fucking magic or something.

      Of course, this isn't to say that he's wrong about xquery - trying to work with unbalanced networks or hierarchies in which the rules change change throughout the schema causes a few problems.

      We already have extensive support for recursion & networks in the more powerful RDMBS (db2 & oracle for sure). But combining that with data structures supporting optional branching, complete lack of declarative constraints, optional rules, etc - sounds like something that will never work well.

      And going back to the days in which you have to spend a day writing code against a hierarchical database in order to answer a simple question sucks.

      Hmmm, haven't people gotten tired of the xml hype yet?

    2. Re:SQL sucks? by Tassach · · Score: 4, Insightful
      people pulled out the UML books in favor of a decent First Normal Form DB
      I'm not sure I'd ever use the words "decent" and "First Normal Form" in the same sentence.

      In 15+ years as a database developer, I've never seen a non-trivial problem which could be modelled correctly in 1NF. In my experience, 3NF is pretty universially considered to be the default level of normalization. Any decision to deviate from 3NF, either up or down, should be documented and backed up with a solid engineering case as to why it's necessary.

      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
    3. Re:SQL sucks? by iabervon · · Score: 2, Insightful

      Actually, SQL is the interface to every non-toy scale data storage project. Non-toy databases are not SQL inside, but use SQL as the high-level language that they compile into their execution plans. SQL is the sole interface language supported by databases with efficient internal implementations, and therefore all of SQL's flaws are overwhelmed in the marketplace by the fact that it's what the good software uses. It's like the named.conf format, which is widely used, but only because it's what BIND uses, not because it's actually good.

      If Oracle started supporting a more friendly API, people would use it instead. I've actually written (for a former company) an OO system for putting together relational queries. With this, I wrote a reporting engine such that you could define a report in an XML file, and it would build the right query and organize the data. It ran better than hand-written SQL queries, and was much easier to write. Of course, it used a SQL back-end to interface with Oracle, but it would have been more efficient if it didn't have to build up a huge query string and then have Oracle parse it. It also would have been nice if I weren't constrained by SQL's limitations. Why can't I have a temporary table with completely specified contents nested in a SELECT statement? It would greatly improve my implementation of "average(x), index(range) for y in range in list(ranges)" (This is just a gloss; the actual code was a bunch of Java applied at various points to a query object.)

    4. Re:SQL sucks? by johnnyb · · Score: 3, Interesting

      You can do some really neat tricks if every row is identified by a globally-unique integer (i.e. - not just for the table, but the whole database). For example, I can create a notes table that looks like this:

      create table notes(rownum bigint primary key default nextval('rownums'), the_row bigint, notes text);

      and have the_row be a foreign key to the whole rest of the database (unfortunately, I'm unaware of any DB that has direct support for this). Then, I can use this table to attach notes to ANY record in the whole database. You can use such generics very easily if you have a common format for a primary key.

      In addition, only very rarely do I find a primary key that I know for absolute certain will be unique.

    5. Re:SQL sucks? by iabervon · · Score: 2, Interesting

      At the lowest layer, it was essentially a system which let you put together a SQL command incrementally. If you want to do an insert, you create an InsertCommand for the table, and then call setColumn() methods for the columns with the desired values. If you want to do an update, it is similar, but you can also add restriction clauses, either by simply requiring an exact match or with a method taking Operand, Relation, Operand. There was support for, essentially, "insert or update row" (like "create or replace view"), which would do the correct operation for the current state of the database without having you write each case and test them yourself. The support for "select" was somewhere in the middle of the range of functionality supported by different SQL extensions.

      So it actually followed almost exactly the functionality provided by SQL, but it allowed you to put it together incrementally rather than with a string constant, so you could have a method on a different object which would take a query so far and a user and apply to the query the access restrictions for that user. Applicability to different problems should, therefore, by approximately the same as an average SQL implementation. It also had the advantage of being able to generate SQL suitable for different databases, so it had a wider applicabilty than completely portable SQL would.

      Of course, the reporting engine was solving a specific problem in a clever way, using the framework. It is true that I extended the framework in a few ways (to include GROUP BY and nested queries) which writing the reporting engine, so you could argue that, until I used it to solve the third (or so) dissimilar problem, it wasn't yet sufficiently general. Still, it would regularly build up substantially more complex queries than either I or our DBA could have written in SQL.

      A particular point I want to make about it is that it wasn't an OO databse system; it was an OO interface to queries in a relational database system. A lot of OO database systems in OO languages have been written, and these are generally less applicable to a large class of problems than relational databases. What most people write are persistance layers for objects, which are much less useful in a lot of situations.

  8. More detailed articles by deepchasm · · Score: 4, Informative

    Readers interested in what Pascal and Date have to say may be interested in visiting Database Debunkings. It has lots of articles written by one or both of them.

    Personally, I recommend the articles written by Date because they are clearly, concisely, accurately, and calmly written. Pascal's tend to turn into a rant, which I wouldn't mind but he always seems to refer to his books rather than give a detailed justification of his arguments.

  9. What the?!... by __aagmrb7289 · · Score: 5, Insightful

    As a rant, this article does a great job. But here's what is missing - what the heck is he talking about? Everything he says is liberally sprinkled with statements telling us these things are self-evident, when they are anything but. He is constantly is referring to how this will clearly show that, or pointing out that this proves this or that later on, but never gets there.

    Can anyone summarize what is being said here in some sort of logical way? Because I'm confused. I see the title, I see no information supporting the title (unless, perhaps, I was to do the research myself).

    1. Re:What the?!... by OscarGunther · · Score: 4, Interesting
      Ever read any Trotsky? Or Lenin? Pascal sounds like any of the old Communists (not the later totalitarians, but the true believers who were old enough to have known Marx or Engels personally). His diatribe is entirely typical of the species. He gratuitously belittles his targets:
      "Natural" perhaps for those without a grasp of data fundamentals.
      (Yes, Fabian, the co-inventor of SQL probably doesn't have a grasp of data fundamentals.) He sprinkles his text liberally with "quotes" and italics so you can "feel" his anger, his dismay -- indeed, you can almost hear him spitting the words in Chamberlin's face. You can almost hear him chortling to himself as he bangs away on his keyboard, demolishing his opponents.

      He venerates the Founder. Finding a quote that supports your argument settles the matter. Codd the Wise avoided the errors that Chamberlin made; clearly the latter is the inferior intellect. And there's only a small core with the Founder. "We" are the true believers; all others are apostates and heretics.

      Overstatement is a definite tell. Chamberlin's explanation of the difference between SQL and XML data is "unbelievable." The nesting argument is "ridiculous." Industry pronouncements are "incoherent." And most prominent of all is the cutting remark that's meaningless to anyone not in the know or already in agreement:

      Unbelievable. Any wonder that SQL fails so abysmally at relational fidelity? We may not expect the average practitioner to distinguish between pictures of relations, which are "flat" due to the presentation medium, and relations of N cardinality themselves, which are N-dimensional logical structures. But we sure expect "industry experts" to be aware of the difference.
      And I sure expect a polemicist to know enough about his art to understand when he's descended into self-parody.
  10. Good grief by Dracolytch · · Score: 2, Insightful

    I'm a pretty good software developer, but if someone doesn't explain to me what the argument is in plain english without extreme haughtiness, I'm going to write off this whole issue as a pissing contest.

    ~D

    --
    This sig has been enciphered with a one-time pad. It could say almost anything.
    1. Re:Good grief by LostCluster · · Score: 2, Funny

      I'm a pretty good software developer, but if someone doesn't explain to me what the argument is in plain english without extreme haughtiness, I'm going to write off this whole issue as a pissing contest.

      The issues in dispute can't be expressed in plain english. That's why we need to upgrade to haughtiness and phase out plain english immediately.

  11. Relation arithmetic by Baldrson · · Score: 2, Interesting
    While at HP's E-speak project I spearheaded some work in reviving Bertrand Russel's relation arithmetic based on the work of Tom Etter, a researcher who had been working at Interval Research on some advanced theories of quantum software. We were trying to solve some basic problems with the way RDF and predication were being pursued in systems like Cyc and the semantic web. Unfortunately, basic research like this is rarely afforded any support at all, and what little support I was able to get wheedle out of the E-speak project dried up after a few months. At least we had a preliminary paper written up for future work.

    I described a general vision for this sort of formalism in a prior slahsdot post. Suffice to say some progress has been made since then -- and work in other areas is starting to converge. There is much yet to be done.

  12. Rediculous by TheRealMindChild · · Score: 4, Insightful

    SQL is meant for a relational database. XML is a hiearchial database... have you never worked on a project where your manager HAD to convert a projects database in XML because it was the new shiny buzzword? It NEVER works out very well because they are logically different. The same will go for SQL->XQuery.

    --

    "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    1. Re:Rediculous by LurkerXXX · · Score: 4, Insightful

      Don't worry, they don't really understand it either. Guys like this bash and bash SQL for not 'truely' being relational (and it's not, but it's the best by far that we have), but they fail miserably at proposing any workable system that *is* truely relational. It's not at all a trivial task. They'll throw a lot of theoretical stuff at you, but never show you a working product that is a feasible replacement for SQL. Tossing SQL/relational stuff into XML is going to get ugly.

    2. Re:Rediculous by (negative+video) · · Score: 5, Insightful
      ...the SQL language retrieves information from SQL databases, not relational ones (the former, Chamberlin's own contribution) due to failure to understand the latter. ...
      Makes me wish I understood a bit more, for it's all a bit confusing.
      Fabian Pascal is smart and well-informed, but a zealot. Like all zealots he is willing to sacrifice anything and everything for his vision of technical purity.

      One of his specific complaints is about SQL NULL values being "unrelational". As an example, a real-world designer might use the following table in a genealogy DB:

      CREATE TABLE people (
      person_id INTEGER NOT NULL,
      name VARCHAR(100) NOT NULL,
      birth DATE NOT NULL,
      death DATE
      )
      If a person hasn't died yet, then people.death would be NULL. Well that just isn't relational enough for our friend Pascal. Since relations can be used to express optional values, then by God they have to be:
      CREATE TABLE people (
      person_id INTEGER PRIMARY KEY,
      name VARCHAR(100) NOT NULL,
      birth DATE NOT NULL
      )

      CREATE TABLE deaths (
      person_id UNIQUE INTEGER REFERENCES people,
      death_date DATE NOT NULL
      )

      It's pure, correctly formed, and worse than useless. It causes a profusion of tables: one for every optional value. It turns every simple query ("tell me useful stuff about this person") into a join ("find matching rows from several tables about this person"). The database server has to waste time enforcing deaths.person_id's pointless UNIQUE constraint. Cascading deletion has to be used to clean up deaths when a row is deleted in people.

      The simple fact is that the world is full of optional, single-valued data. NULL-allowed columns express that data efficiently, without confusion, and without breakage. Community college database designers have no trouble using the convention productively. It may be a little inelegant, but it is pragmatic and balanced engineering. The only whining you hear is from zealots like Pascal who heap fire and fury on others, but never seem to deliver the mythic PerfectoRDBMS.

  13. Re:It would seems SQL is better for RDB than XDB by TheSunborn · · Score: 3, Informative

    And the problem happens as soon as you want to know which producs uses a specific screw. Doing that query against the xml would be difficult, and/or extreamly slow.

    Martin

  14. Error: User doesn't know how to use program. by LostCluster · · Score: 5, Interesting

    Most of the problems that I've seen with SQL commands that are more complex than they really should be are a result of mistaken assumptions made during the design phase of the database. As a result, extra tables get added late, and therefore create new "features" that code then has to be revised to take advantage of...

    XML's going to be no better in this area. Mistakes made during the design phase will always come back to haunt while implementing and using the system. If a single query can't return the results desired, then that should have been thought of while designing the tables of the DB. Trying to get a query to specify "All things that are red" like Pascal suggests is only going to work if all objects implement the "color" property the same way. If somebody uses CMYK, somebody else uses RGB, and a third uses Play-Doh color names, it's still gonna be a mess that requires code to figure out who really matches whom.

    I don't see how this "new model" fixes the real problems with working with SQL between databases that weren't designed to work with each other.

  15. Peddling a better way? by BillsPetMonkey · · Score: 5, Insightful

    A legacy application is one that works. And the same can be said of SQL. Actually XML works too.

    It's important to understand what XML is replacing - binary or proprietary interfaces. This means an acceptable tradeoff between human readability (a hugely underrated requirement of a structured data format) and efficiency.

    An example is EDI vs XML. EDI "efficiency" accrues only to the intermediary that invented the means to setup trading relationships across their proprietary network. XML uses the end users' bandwidth but it simultaneously eliminates the intermediary completely. This single fact saves literally millions in kilocharacter and storage charges.

    SQL is what my old compsci prof would call opportunity-cost efficient. It's quick and can be implemented a number of ways - it's a data query framework, not a requirement for databases. There may be better ways to do it but you'll have a tradeoff somewhere.

    And if someone offers something better, then when they've finished telling you how good the new way is, wait and listen for the inevitable sales pitch.

    --
    "It's not your information. It's information about you" - John Ford, Vice President, Equifax
    1. Re:Peddling a better way? by rjamestaylor · · Score: 2, Insightful
      XML doesn't eliminate the intermediary. Eliminating the intermediary eliminates the intermediary.

      I mean, one can kiss of the intermediary with CSV files, financial 5-bit data files, packed decimal data files, string-and-cans dictation systems, etc.

      And one can sign up to use any number of intermediaries with their brand-new XML data files backed with excellent XSDs, etc.

      The data file does not bear on the intermediary.

      I don't have time here but I will postulate what anyone doing data integration with disparate parties knows: XML only solves the parsing questions; data meaning still requires conferences and/or tomes of explanatory text to explain beyond the grammar of XML, XSD, etc.

      Automated data integration is not possible unless one side is willing to do all the coding to match a well-publicized protocol with a test server for honing the solution.
      <rant>

      • In fact, I think XML, with its inherent repetition of "column" and "field" names (as in the repeated-for-each-tuple tag names) is a conspiracy amongst Intel, Western Digital and Level3 to sell more advanced processors, bigger disks and higher bandwidth allotments.

        Doubt me? Name one project having complicated two-way data interchange that did not require a face-to-face meeting between development teams where both sides used all current-state-of-the-art XML tech and tools. Just one.

        The only thing not needed to discuss is "how do you delimit fields containing your field delimiter." Other than that all the old questions are still valid (as to meaning and optional representation) and new ones exist (DTD?, XSD?, doctype? Version of XML? Order of data elements? Attributes? Whitespace handling? Characterset?).

        XML: Big Waste of Time (for data integration). Bigger waste of process cycles, bandwidth and disk storage.

      </rant>
      --
      -- @rjamestaylor on Ello
  16. Re:It would seems SQL is better for RDB than XDB by kpharmer · · Score: 2, Informative

    > An iterative SQL call would be needed unless the overall part depth was known at query time.

    Both oracle & db2 have very good support for recursion. DB2 in particular can easily handle hierarchies and networks of unknown depth in a single query.

  17. XML Misunderstandings by Decaff · · Score: 4, Interesting

    The author seems to have many serious misunderstandings about XML.

    The fact is that in order for any data interchange to work, the parties must first agree on what data will be exchanged - semantics - and once they do that, there is no need to repeat the tags in each and every record/document being transmitted

    A major point of XML is that the semantics should be explicit. If you don't repeat the tags, you reply purely on position to indicate meaning. This is a Bad Thing. For example, it does not allow sparse data in which non-default or null values can be excluded.

    Inter-system data exchange requires an agreed-on efficient machine-readable delimited file format.

    XML was designed to avoid the issue of 'yet another machine-readable format'. XML can be read reasonably efficiently, but always preserves meaning, ignoring the horrors of character sets and byte order. Compressed XML is a very efficient way to transmit data.

    An important part of XML design was that it should allow information to be expressed in a way that is independent of the software that uses it. In this way, it has something in common with SQL. The point of 'human reading and writing' is that in the last resort, you still have you data! It also makes data transfer hugely easier to debug.

    There is also a lot of confusion about the order of tags in XML. Its possible to specify in a schema or DTD that some tags are required and should be in a certain order, but its also possible to just not care about order. XML is neutral about this.

    1. Re:XML Misunderstandings by Decaff · · Score: 2, Insightful

      The author is actually actually arguing that tags are syntactic, not semantic.

      He seems to be not sure what he is arguing, as far as I can tell. After all, XML is fundamentally a semantic markup, using HTML/SGML syntax. He seems to be arguing that sematics can be indicated by position, and that tags are unecessary and Any agree-upon delimited format will do. I strongly disagree with this.

      You can use XML as a syntactical markup, but its rather a waste:

      <record><data>1</data><data>Surname</data></reco rd >

      This is just silly, and is no better than CSV, but seems to be the kind of thing the author is arguing for; positional markup in some format.

      Its far better to have an XML schema that includes semantics:

      <record>
      <data type="int" name="id">1</data>
      <data type="String" name="Surname">Surname</data>
      </record>

      or even better
      <record>
      <id>1</id>
      <surname>Surname</surname>
      </record>

      If you do something like this, semantics ARE included in the tags. With the appropriate namespaces and schema/DTD, you can mark up pretty clearly what the data means in a way that just about anyone can understand.

  18. Things you use XML for by Decaff · · Score: 2, Interesting

    Use Open Office? unzip that .sxw or .sxc file, and what do you see? XML.

    You probably use XML a lot without knowing it.

  19. Never heard so much nonsense.. by wdavies · · Score: 3, Insightful

    ok, aside from efficiencies in implementation and writing, the main concern should be with the expressability.

    Question - can you express the recursive ancestor relation in SQL? You can express a single relation such as grand parent, but not the full relation.

    Reason? Because SQL is not full relational calculus. It is basically propositional calculus (actually I maybe slightly wrong, and it falls in a higher calculus than propositional).

    Prolog for example is closer, but still not true relational calculus (I forget whats missing).

    There's a reason for SQL's limitations, and that's decidability - guaranteeing that the query will terminate... (admittedly in theory, and you can write some pretty horrendous statements).

    Anyway, just wanted to get that off my chest. Doesn't say much about where XML falls in the scheme of thing - I guess strictlt speaking it doesn't - its just a layout. In fact, to compare XML and SQL is a complete misunderstanding. Its XSLT which should be compared.

    1. Re:Never heard so much nonsense.. by FnH · · Score: 2, Informative
      Question - can you express the recursive ancestor relation in SQL? You can express a single relation such as grand parent, but not the full relation.

      I beg to differ:

      Given ParentOf(parent,child)
      The ancestors of 'Mary' are:
      WITH RECURSIVE Ancestor(anc,desc) AS
      ( (SELECT parent as anc, child as desc FROM ParentOf)
      UNION
      (SELECT Ancestor.anc, ParentOf.child as desc
      FROM Ancestor, ParentOf
      WHERE Ancestor.desc = ParentOf.parent) )
      SELECT anc FROM Ancestor WHERE desc = "Mary"

      SQL might still not be true relational calculus (but then again, it might as well be, I don't know, and the parent doesn't know either), but at least it't possible to express the ancestor relationship.

      Now, if only the PostgreSQL guys would implement this ...

  20. An extreme position, but with good points by MobyDisk · · Score: 3, Interesting

    This guy is really smart. He takes issue with the design of SQL, and with some of the commonly-used relational-database concepts (such as the NULL). His criticisms here are valid, but his position seems to be extreme. With that said, he is absolutely right about XQuery/XPath/XQueryX++/whatever.

    XML is great for data exchange. Schemas are a wonderful way to describe data. But it is completely inappropriate for querying. If you need to query XML, you should import it into a database then query it that way. The very design trade-offs made when building XML were to make it extensible, and hard to query. XPath is nice to have for simple dinky import scripts. But trying to build a whole hierarchical query language on top of XML is silly.

    If someone wants to build a standardized hierarchical query language, that's great. Very few people use hierarchical databases and need such a language, but I wish them luck in that endeavor. But don't pretend that it is appropriate to use it on XML, or that it has anything to do with XML. XML is an interchange format. Leave it where it works well.

  21. Solution Today! Alphora Dataphor by Anonymous Coward · · Score: 2, Interesting

    To see the solution to almost all of the problems identified by Pascal, Date, Darwin and Codd please checkout Dataphor from Alphora. I am a user of their project and it is a marvel. It uses any vendor's DBMS for storage and heavy lifting, but adds untop of it true relational lanaguage and constructs. The system is so highly formalized that Dataphor provides *instant* derived user interfaces for all your tables in your existing database. After taking a few days to supply the missing information about your data that you currently cannot do in your DBMS the instant UI knows how to display all tables and forms in a logical workflow. It also handles all form validation and referencial integrity. If you change your database schema the UI is automatically updated because it is *derived*. It is not the result of some lame MS Access style wizard.

  22. Nitpick (OT) by wtrmute · · Score: 2, Informative

    This is off-topic, but it bothers me when someone blasts another for ignorance and then links into an otherwise perfectly good article ("The Myth of Self-Describing XML", by Eric Browne)which contains the following pearl:

    The business logic cannot be constructed post priori!

    Doesn't it bother anyone that someone who doesn't know his Latin (but uses it, anyway, where a perfectly good "after the fact" would suffice) is used as an authoritative source by the author? If you're trying to prove someone's incompetence, you won't want to counteract it with further incompetence. Mr. Browne may be a genius in relational databases, but makes stuff up just the same.

    And in the unlikely case Mr. Browne should read this post, the correct form is a posteriori, as any law student probably knows.

  23. SQL is not a Relational Database by Anonymous Coward · · Score: 2, Interesting

    The consensus clearly is that the Relational Database is an unqualified success, and that is true. But don't confuse SQL and the Relational Database. SQL was an early hack intended for querying the RDB only.

    Part of the problem is that the RDB was such as success that people do confuse the two. SQL, however, has shortcomings, that are addressed in the third manifesto.

    This product http://www.alphora.com/ is a serious attempt ot address the shortcomings of SQL, with a new language for programming an RDB, and a new Query language.

    SQL itself is not complete, and even the RDBs out there today break many of the rules as set out for the correct RDB.

    Fabian Pascal is a bit of a nutter, you wouldn't ask him around to a dinner party, but he is correct.

    XML is a badly thought out hack, but it works to an extent.

    UML is hardly that, the U is really an act of hubris.

    SQL can be improved, made more complete, and RDBs should be made to confrom more closely to the rules of what makes a real RDB.

  24. Who the f*ck designs databases in SQL anyway? by Qbertino · · Score: 4, Insightful

    I know some people who do in some cases, but I wouldn't exactly call that a standard procedure. Or call those people DB designers for that matter. 'Cause that is NOT database design.
    You design a DB best with a pen and a large sheet of paper. Or some drawing tool your extremely good at.
    SQL is the language you feed you results into the box so it builds a more or less representative imprint of the abstract reality you've designed. Which can be as relational as you want it to - as long as it meets the physical constraints of non-abstract reality. As soon as you put it onto a computer, you'll have to cut corners. That's the difference between a database _model_ and a database _implementation_. That takes stuff into account like DB load, DB Server Features and data types.

    Types for instance - somewhat relevant when dealing with DB Servers and SQL - are a thing you don't want to touch with a ten-foot pole when designing a _model_.

    I'm suprised a supposedly db expert guy get's all worked up about this and doesn't seem to be able to keep apples and pears apart.

    Anyone initially designing a non-trivial DB with SQL and - on top of that - bitchering about this DB language not being rational deserves a clobbering.
    My 2 cents.

    --
    We suffer more in our imagination than in reality. - Seneca
  25. An attempt at a better solution. by perlchild · · Score: 4, Interesting

    Until then, SQL works. What more can you say?

    That SQL is mostly a kludge?

    Let me restructure that...

    The experts who know what the heck the relational model is and is not argue that the language we use to query a specific type of relational-like database, that they call the SQL databases, the SQL language, has unsufficient representation power to represent the whole model, and hence can't be used to get the whole power of the model.

    That's certainly interesting, and leaves us to ponder two things:

    1) a) Just how much more power could we get? b) And at what cost?

    2) What about alternatives, can we get that same power elsewhere, cheaper?

    1)a) is beyond my mere predicate logic skills at this time.

    1)b) The cost of a model for data storage, representation and management is directly linked to it's adaptability to the data you represent. The article mentions a lot of errors with NULLs(I remember thinking, while reading the article: a NULL was an attempt by the language developers to simulate an interrupt in a language that doesn't have any, this is of course, an oversimplification on my part, but considering stored procedures and triggers[SQL's own exceptions] weren't around yet, they sound like a good basis for further research.) There are a lot of other hidden "costs" for people who use a relational tool for not-quite-so-relational data, but that's not part of the cost of a relational language, per se.

    2) Brings up a few notions: there are the types of databases relational databases replaced, like network databases, and there are attempted replacements, like object databases. There are also further possibilities that I will explore deeper later. Object databases can certainly be interesting, in the sense that by bundling data with code, you can have data that can handle itself, in the very basic sense that we humans apply it to ourselves. The problem is that we tend to have a very fuzzy, real-world view of such data, and can't work with it that easily(we are using computers to make data easier to work with, so if we had software that could handle real-world data complexity outside of our brains, we wouldn't be having this discussion). Object data is certainly very adept with data that has some broad commonalities, re-usable behaviours, and follows set-rules. We can call those business rules for now. Those business rules imply that a certain subset of "The Universe" interests us more than the rest, and follows predictable commonalities, making our mental models a lot less complex. On the other hand, object methodology is not always well understood, and the documentation and models it generates sometimes dwarf some production systems implemented to solve the same problems.

    Now, at the beginning, Relational Systems were data-handling "toolkits" set to handle specific subsets of data, who also followed business rules.
    That's interesting to my purpose, simply because I can envision, at this time(some vendors have similar concepts, but don't formalize them in any way), a new set of "toolkits" where the relational model is only one of many "toolsets" available.

    Indeed, what is probably the most used sql-based server available(MySQL) has been lacking true relational functionality for most of its life, yet that doesn't make the tool less useful for most of its users. Future toolkits can inspire themselves by focusing on specific uses of technology to solve specific problems, and yet keep the SQL as a sort of security blanket, since that's where most of the training about databases(and indeed, usually most of the training about data, period, is in database classes and perhaps, some algorithmics classes)

    After reading the linked articles about XML's weaknesses, though, I don't think it belongs into any toolkit of that nature. Simply because the tool that belongs in the toolkit is the "self-documenting data", and XML's weakness in that area is evidenced there. XML's early focus as a medium of e

  26. The Problem, stated more accessibly by IBitOBear · · Score: 4, Informative

    The problem is that most "Relational Database Management Systems" only represent one type of "relationship", that being "the table".

    This, in turn, means that every operator (programmer, statement, etc) on the database must _individually_ "already understand" all the relationships that lie outside "the table" before they can act on the data at any significant scope.

    That is, you, the programmer or operator must know, from some source besides the RDBMS itself, how the different tables work with eachother.

    In simpler SQL-biased terms, you have to know, before you start, what is "good" to put in your WHERE CLAUSE to make a join. And then the RDBMS query optimizer needs to guess how to satisfy your needs in something other than glacial time.

    Consider a new verb "EXPOSE thing, thing, thing, thing, thing..." that would fish out of a database the one-or-more relationships between the things, and produce a table-looking vector of "tuples" that consist sets of actual values for those things. This is what the theoretical "perfect" RDBMS would do.

    Given (somewhat denormal 8-):

    Customer ID -> Customer Name
    Customer ID -> Street Address
    Customer ID -> Zip Code
    Customer ID -> Purchase Order ID
    Purchase Order ID -> Part Number, Quantity

    One should be able to "EXPOSE Part Number, Zip Code" and have the database "know the relationship" and produce the correct vector of tuples.

    But that doesnt happen.

    Now all the people bleating about the Higherarchial databases and bad things from the past are doing this harping because they remember the bad-old-days when a database would maintian one tree-structured set of relationships like this. In the higherarchical model, you could basically do this EXPOSE operation, but only if you had, by dint of pre-knowledge, asked for things lying on one linear path through the tree. (* simplified for brevity).

    In essence, SQL requires you, the programmer, to be in the business of making up relationships that should be in the data or schema structure but isn't.

    A magically complete RDBMS would take a series of vectors of the form "Independent Datum (key)->Dependent Datum (value)" (where either side of the arrow could be a list of atomic values). The RDBMS would then assemble and maintian tables or linked lists or whatever with no exposure of SQL-esque "tables" and the accessors would be storage method agnostic. (That is, there would be no such thing as a FROM CLAUSE.)

    For instance, in the above list of relationships, Customer ID, Customer Name, Street Address, and Zip Code *could* all live in a "table", or not, but you would never know that. But a better vector of
    Customer ID -> Street Name, Building Number, Suite to replace "Customer ID -> Street Address" has a table-feel, but would not bias against "EXPOSE Street Name, Part Number".

    The power of this comes from being able to do:

    EXPOSE Building, Part Number, Quantity
    Where Building == "Word Trade Center 2";

    And have the RDBMS already know the sequence of relationships to get from Building to (address elements) to Customer ID, to Part Number without the programmer writing the three stage join across the "uninteresting middle tables".

    (The above presumes you have a building relation that has Street Name, Street Number -> Building or some such.)

    All the XML nonsense is nonsense *_BECAUSE_* the strict-nesting enclosure requirements of XML make it "naturally" become hierarchically organized. But data exists outside the single-inheretance strict parantage trees that the hierarchical model dictates.

    The problem is that SQL got real popular and so the idea of structural inferrence got pared down to tables and Query-Like constraints on tables before anybody had a chance to formalize the idea of living, encoded relationships between arbitrarily stored datum. So we never really got a language or system that could "EXPOSE".

    --
    Innocent people shouldn't be forced to pay for inferior software development.
    --"Code Complete" Microsoft Press
  27. Theory vs. practice by 14erCleaner · · Score: 2, Insightful
    I'm not really much into data modelling theory and such, but I do have two perspectives from which to view this dispute:

    I've done several years of application programming using SQL

    I've also implemented the (XQuery-derived) query processing module for a native XML database

    In my former life as a application programmer, I really liked SQL. It allowed some pretty complicated computation to be done in the query, and very concisely in many cases compared to doing the same thing in, say, C++. For example, things like grouping are very nice for many application purposes.

    In my current job, I'm hoping to create an XML query language that supports the same sort of capabilities as SQL. Our XML query language implementation has decent path/predicate, sorting, and output structuring capabilities, mostly derived from earlier drafts of XQuery.

    My feeling about XQuery 1.0 is that it is extremely bloated. XML seems really simple; querying it shouldn't be all that complicated, should it? But the XQuery committee has created several hundred pages of specifications for the new language. This seems excessive, to say the least. We basically have implemented a subset of an earlier version (with paths, predicates, sorting, XML construction, a few dozen functions), and stopped tracking what they were doing. This is kind of unfortunate, but we really don't have the resources to support his behemoth in all its awesome grandeur.

    We just want a language that lets programmers efficiently access our database. I think we're on the right track. I'm not at all sure that XQuery is going to wind up as a long-term success, partly because of its bloat factor.

    My favorite illustration of the XQuery bloat is this: early versions (up to about April 2002) of the XQuery language description contained this sentence in the introduction:
    It is designed to be a small, easily implementable language in which queries are concise and easily understood.

    Starting in August 2002, this was changed to:
    It is designed to be a language in which queries are concise and easily understood.

    The "small, easily implementable" part got smothered up by the avalanche of features they were adding.

    --
    Have you read my blog lately?
  28. The academia is forgetting the whole point of XML by anttix · · Score: 3, Interesting

    "XML is not meant to be read by humans, it's a data interchange format and thus meant to be read by machines" - Good heavens!
    Someone saying something like that has really got a BS in BS! Or perhaps even worse: a PhD in BS.
    XML is all about programmers being able to understand the data! Yes, because we are not anywhere near that nirvana of fully semantic systems that can (semi)automatically understand each other. NO! Programmers have to do the work to make the systems fit together and XML gives them the advantage that they do not have to reverse engineer another proprietary data format or dig into a horsepile of documentation. XML makes it easy to understand how to process the information at hand - without any extra work!
    Also it's great format for storing small amounts of constantly changing data (like user preferences) cause it's extensible and with only a tiny bit of effort backward compatible as well.
    Anyone trying to use XML for processing large amount of data (like data warehousing) is either nuts or doesn't give a damn about the speed or costs.
    However anybody using XML for long term data storage is a genius since other "more efficent" formats will be obsolete ten years from now and the software that can read it can be extreamly difficult to obtain (anybody who has tried to decode data from some long gone accounting package from the '80-s knows what I am talking about).
    So yes XML is self describing only to humans and that's the whole point of it. Formalizing data semantics is not the goal of XML, has never been and will never be, thats what we have RDF, RDFS, OWL and other nice initiatives from Semantic Web movement for.

  29. Conflicting goals by esap · · Score: 2, Interesting

    I think this whole dispute is not necessary. It's just a simple case of conflicting goals. One side wants "efficiency" and another wants "extensibility". What both sides miss is that real systems can't afford to choose just one of these, you have to get both. So you have to have just enough extensibility to allow reasonable extensions, and still attain reasonable levels of efficiency. But trying to get all of either thing will totally lose the game. So the XML camp is wrong to think that extensibility is everything (ever tried parsing XML in a real-time system?). And the "binary transfer format" camp is wrong to think efficiency is everything (ever tried to make two versions of your protocols to interoperate?).

    --
    -- Esa Pulkkinen
  30. Re:The Criterion here is no longer machine efficie by warrax_666 · · Score: 2, Informative
    The point of al those repeated tags is that machine time and bandwidth is very cheap now, but human time is not. The beauty of XML is "agreed-upon" is optional now. We can understand the data without a formal meeting to come to an agreement.

    No. You. Can't.

    You simply cannot know what the data means without specified semantics (which you have to agree upon somehow; they aren't magically apparent from the XML itself -- that's why such abominations as DTD and XML-Schema exist).
    --
    HAND.
  31. You Are Missing the point of NULLs entirly by IBitOBear · · Score: 5, Insightful

    table: order ID, part number, quantity shipped

    select part number, sum(quantity shiped), avg(quantity shipped)
    Group By Part Number;

    This works with NULLs in the column for quantity shipped on parts which have not yet been shipped. If you just use zero for "no shipment" then your average number will have no real value for answering questions like "how much do we spend shipping these parts, on average?" etc.

    If you wan't to throw an exception you can throw the execption or not in your program. In that case you fetch the individual values and do the math yourself and the "that's not a number" that is caused by the null gives you the chance to throw your exception.

    But since, in aggregate operations, your program isn't even interractin with the data yet, where would such an exception go?

    What would the SQL syntax be communicating a list of results PLUS a list of exceptions to your program? Which order would things be processed in?

    Your boolean analogy is also flawed. "You have stopped beating your wife?" is not a yes-or-no question because it carries a predicate around with it that you may not fulfill for serveral reasions (not married; you are hetrosexual female, so you don't have a "wife", you have never beaten your wife so you can't "stop" doing it; etc). There are a surprisingly large number of "real data" that nature. For those of you who have trouble abstracting this, the "real comparason matrix" is "True, False, and Not Applicable". NILL buys you "Not Applicable" so very cheaply.

    In poin of fact, people who don't like NULL, usually because they don't understand its purpose and use, make a hell of a lot of work for themselves.

    My current employer has a large database of test values that grows by huge numbers of elements each day. The programmer "didn't understand" NULLs (ro RDBMS' for that matter) and has "-" in fields that should be NULL.

    Consequently we cannot aggregate. All of our client applications end up haveing to bulk-fetch whole table ranges and run through elaborate statistical routines full of conditionals; or do separate fetches with "field != '-'" in the where clause and run a concordance operation in ram after the repeated bulk fetches.

    This costs bocup time and degrades the quality of the product.

    You call "academic bullshit", I suspect you have never had to work the really large or significant data sets. I suspect that you don't ever ask the server-side to aggregate for you. And I suspect you have never worked time-critical transactions across a "slow" link.

    You can't have. You think of "NULL" in terms of equality.

    I will give you the "syntatic" point that "Where X = NULL" ought to be unversal. But, for instance, the cartesian nightmare of having "NULL == NULL" in a join is beyond idiotic.

    --
    Innocent people shouldn't be forced to pay for inferior software development.
    --"Code Complete" Microsoft Press
    1. Re:You Are Missing the point of NULLs entirly by IBitOBear · · Score: 2, Interesting

      In your example, you still need part_number in table2 unless you allow only one part per order ID.

      The iterative join needed to then needed to print 10,000 invoices of average-of 20 parts per invoice gets too expensive to be reasonable.

      It can be done, but it becomes anti-helpful.

      Remember, normalization can go too far. By splitting the table you have now doubled your storage requiremet and multiplied the training, implementation, and execution costs since every operator (person or statement) and ad-hoc-query agency now needs to "know" that these two tables are needed to fulfil the "normally dense" query.

      (That is, over the lifetime of the database, most orders will have been shipped so most quantity shipped datum will be present.)

      With NULLs properly used, you can "SELECT COUNT(quantity_shipped)/COUNT(*)" on a single table and the answer will come from the traversal of one table or index. With two tables it would be a join.

      If you actually look at the assembled wisdom of the field, you will note that you are supposed to STOP NORMALIZING when it stops helping and starts causing harm. /sigh

      --
      Innocent people shouldn't be forced to pay for inferior software development.
      --"Code Complete" Microsoft Press
  32. NULLs and Normalization by PatientZero · · Score: 2, Informative
    You can't get rid of NULLs and maintain Normal Form. The two are simply at odds with one another.

    No, they are not, but the way to rectify them is a bit extreme. Keep in mind that -- as Date says again and again -- there is a difference between the logical model and the physical model. I'll summarize the example he used: a EMP_SALARY table.

    Let's start simple:

    EMP SALARY
    ---------------
    Alice 100,000
    Bob NULL
    Chris NULL

    [Sorry, ecode doesn't seem to want to do vertical alignment.]

    Now, what do those two NULLs mean; do they carry value? If Bob is unemployed, we could write 0, but then it could be confused with unemployed and employed for no pay. Perhaps we don't know how much money Chris makes, but we do know that he makes some money.

    You could fix this by adding a TYPE enumeration column that would take on values like EMPLOYED, UNEMPLOYED and UNKNOWN, but you'll still need the NULL value for the UNEMPLOYED and UNKNOWN cases.

    This last part can be solved by logically segregating the table above (sans TYPE column) into three tables (one per type). Both the UNEMPLOYED and UNKNOWN_EMPLOYMENT tables would lack the SALARY column -- they would have only the EMP_ID as there's no more information to add. All rows in the EMPLOYED table would have a known salary.

    NULLs have been removed and the design is further normalized -- some would say to the extreme.

    Now, how you would model that physically without using NULL and still managing some level of performance I do not know. But that at least explains the reasoning behind NULL not being necessary.

    As for myself, after nearly fifteen years of database design and implementation, I'm quite satisfied with using NULL where appropriate. I've never been befuddled by it nor sidelined by its behavior with respect to logical operators. Learn the rules and move on.

    --
    Freedom to fear. Freedom from thought. Freedom to kill.
    I guess the War on Terror really is about freedom!
    1. Re:NULLs and Normalization by PatientZero · · Score: 2, Insightful
      Now that I think of it, I suppose that first normal form wouldn't be violated as long as you ALWAYS separated out the nullable field. Considering the complexity this adds, it's difficult to say whether it is worth it or not.

      Exactly! I've always been in the position of needing to get stuff done, and that has meant focusing on implementation at some point. While some people get all weird with NULL values, I simply look at it as a workable solution.

      I would never fully normalize to the point above, but the discussion is helpful in clarifying the logical design. Who knows, maybe we'll get a "truly" relational DBMS someday. Until then, I'll keep the NULL, thanks! ;)

      --
      Freedom to fear. Freedom from thought. Freedom to kill.
      I guess the War on Terror really is about freedom!
  33. What an arrogant twit by Salamander · · Score: 2, Interesting

    It's one thing to say that either SQL or XQuery have their problems, because they do. It's quite another to say that SQL is bad because it doesn't live up to some arbitrary never-achieved (and perhaps unachievable) standard of relational purity that even Codd himself found superfluous. When Pascal does nothing but the latter, and in addition takes a dozen thoroughly unprofessional swipes at Chamberlin for having been involved in both SQL and XQuery, his professional jealousy is becomes thick enough to choke on. I wish he would, so we would be spared the incessant ranting of someone whose whole career has been marked by a lot of words and not a single deed to back them up.

    --
    Slashdot - News for Herds. Stuff that Splatters.
  34. Re:The Criterion here is no longer machine efficie by geekoid · · Score: 2, Interesting

    "The point of al those repeated tags is that machine time and bandwidth is very cheap now, but human time is not"

    yeah, you tak a file that has 1000 linse, each line has 1024 characters, and 300 fields. Transmitted from Brazilla at 28K.
    Now convert the to an XML format, and then try sending it. suddenly it take 10 times longer to get the data. Literally going from a couple of hours to all day. Not exactly cost effective.

    XML is easy to read, if you know the format and context in which your reading it. It still needs to be designed, you still need to go to meetings, and you still need to create paperwork on the structure.
    It's got its place, but it is not the end all, or even cloce for that matter.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  35. The problems of preemptive data typing by ynotds · · Score: 3, Insightful

    (I just used my mod points in another thread, so I gotta hope other mods recognise the parent post.)

    In the world of self taught dabblers, NULL is not well enough understood to be expected to do anything more than cause the kind of problems you alude to with the likes of '-' to (partially) imply what NULL should be used for.

    SQL has to coexist with other components where an empty string and a numeric zero are assumed null and treated accordingly, the quantity shipped example you give being just as easy to understand and implement with zero meaning not shipped as with a separate null (just add "where quanity shipped > 0").

    There are also several possible reasons for a data value to be left NULL or undef, not all of which are mutually exclusive. Is it "not yet", "not known" or "not applicable"? In the real world we sometimes need to pair a status enum and a (numeric or string) value column to properly represent a single logical datum which needs to sometimes take state values not sensibly representable by numbers or strings.

    We used to use a string of 9s in a numeric key field to represent end of data and even today Perl's DBI interface uses the 0E0 kludge to represent a "true" zero.

    --
    -- Our systemic servants do not good masters make.
  36. Pascal should go into Theology by Precipitous · · Score: 2, Insightful

    Pascal's entire line of argument fails to explain why I should care. I RTFA'd. I even read some of the links. This is a topic near and dear to me, as I fight for better design, better technologies at work against various technology and platform zealots.

    I'd argue that if you have a thesis or hypothesis, you need to make a testable predication and test it against the real world. That's the gist of science. Pascal tests XML and SQL against the Gospel of Formal Data Model's according to Codd. Pascal's arguments are theological, not practical, not scientific.

    I want to know how XQuery will or will not make my job of designing and implementing solutions that save my company money. How will the problems of XQuery, or the blasphemous SQL implementations cause me problems that cost time? How do these deviations for orthodoxy really make code harder to write, harder to maintain, more prone to error? These are the relevant questions. These are issues that can also be tested against production scenarios.

    I don't give a hoot about how well XML falls into Codd's formal model. I care whether or not it saves me time. I'll happily accept that normalization, taken not too literally, does saves me time. XML also saves me lots of time: makes a great prototype to store data in (gasp!) before I implement the database layer. Even for a somewhat complex schema, I can blast out a small XML document in a few minutes in my text editor of choice, and test out how the components use the data that they store. Sometimes, for small data sets such as configuration information, I even leave it in XML for years before finding a compelling reason to deal with an RDBMS. Web services (the horror!) have made the middle tier much more accessible - I can drive access to a service based on policy now, rather than to whom I can distribute the damn DLL and it's dependencies. None of this is perfect, but XML works where it makes a difference to me.

    In short, regardless of how well or poorly Pascal addresses his questions, they are the wrong questions addressed in the wrong way. He should go into theology or critique Chinese literature and leave us working folks alone.

    --
    My motto: "A cat is no trade for integrity."
  37. Put these arguments in perspective, please by rycamor · · Score: 4, Insightful

    One thing that everyone should understand: even though Pascal, Date, etc... argue that SQL is a bad implementation of the relational model, they *still* agree that it provides value, and that it is miles better than its hierarchical database predecessors. Since it is their job(s) to provide a reasoned critique of the field, it is only natural for them to rigorously compare SQL to the goals of the relational model. Many of their complaints fall in these categories (although there is much more):
    1. Does too much -- too many ways of doing the same thing, and too many unecessary operations that could be better done another way.
    2. Overly complex -- the SQL 1999 standard was something like 1200 pages.
    3. Allows programmer to circumvent relational integrity. Things like "hidden identifiers", pointers, etc...
    4. Too wrapped up in implementation -- users must spend a lot of time understanding the physical storage, rather than focusing on queries in abstraction.
    5. Many small inconsistencies in SQL itself

    But the problems with SQL are impossible to judge if you only know SQL. It's like the people who used to ask what was wrong with a perfectly good typewriter that made people want to use a word processor. To any who are curious, I suggest you do some reading. The absolute best simple introductions for these problems are in a two online documents by Hugh Darwen at www.thethirdmanifesto.com. Look for "The Askew Wall", and "The Importance of Column Names".

  38. Re:FUD FUD FUD by ianezz · · Score: 2, Informative
    As for "stored procedures, views, triggers, ..." these fall under the category of --USELESS FEATURES--.

    ...useless until you realize you have to connect to the DB from several applications written in several different languages for which you have either to reimplement your way to manipulate the data everywhere, or you have to put in a middle layer of some sort which is able to talk multiple languages (via CORBA, SOAP, plain XML RPC, custom protocol, whatever) and ensure that everyone is accessing data exclusively through it.

    Reimplementing logic everywhere across different languages is usually a bad approach because it doubles the development and testing effort.

    Middle layers are usually hard to get right the first time, much harder than using stored procedures and triggers, since the typical procedural language is not so at ease at manipulating relational data.

    On MySQL: it has a somewhat bad reputation in the field because of the people abusing it: it's fast, it's free, it's easy to set up, but living with these gotchas is definitively too painful for developers more concerned about correctness than speed.

    In the end: firing up Firebird/Oracle/PostgreSQL/SAPDB for simple data is plainly stupid, but often it is done anyways since they do a decent job even in that cases; firing up MySQL for your 30+ GB DB containing your whole network topology which is used by everyone for billing, service assurance, troubleshooting, network planning and whatever is stupid as well. MySQL AB knows that, and in fact it now proposes MaxDB (was: SAPDB) as well.

  39. Identity and the standard by tarvin · · Score: 2, Informative

    You are wrong. The SQL:2003 standard specifies IDENTITY. See http://troels.arvin.dk/db/rdbms/#mix-identity

  40. Re:The academia is forgetting the whole point of X by leomekenkamp · · Score: 2, Insightful

    XML is all about programmers being able to understand the data!

    No. XML is all about storing meta-data alongside the data. And you are implying that programmers will not understand data that is not easy readable, like XML; this implication is an oversimplification.

    (...) reverse engineer another proprietary data format (...)

    XML is certainly not the only well-documented interchange format.

    (...) dig into a horsepile of documentation.

    Is is fairly easy to create XML documents that require horsepiles of documentation, just like any other format. Just look at the XML output of Microsoft Office; XML is no magic bullet.
    (...) (like user preferences) (...)

    No, one should use an API for that and be independent of storage meganism.

    However anybody using XML for long term data storage is a genius since other "more efficent" formats will be obsolete ten years from now and the software that can read it can be extreamly difficult to obtain

    I would not like to retrieve all information from abovementioned Office XML files right now, let alone in ten years time.

    So yes XML is self describing only to humans and that's the whole point of it.

    Ehhm, no. Human readability is a side effect that probably led to its widespread adoption. Work is underway to make certain XML far less 'readable' to humans, but smaller and faster to process.

    Formalizing data semantics is not the goal of XML (...)

    No, because that would require AI, but formalizing meta-data semantics most certainly was a target set for XML to achieve the goal of better data interchange.

    --
    Wenn ist das Nunstueck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.
  41. The Data man. problem must be solved at O/S level. by master_p · · Score: 2, Insightful

    One foundamental error in today's operating systems is that they are datatype-agnostic. They simply don't know what the data they handle is. This task is left completely to applications, and each application usually provides its own way of managing data. This causes incompatibilities between applications, and these incompatibilities are not solved either by SQL or XML (that are nothing more than human-readable representations).

    In my opinion, an operating system must primarily provide a data management solution. It must provide the common ways to organize, store, retrieve and process data. This means that the application should only care about the logic behind the data, not how data management is implemented. There are only a few methods of data organization anyway, and it is a shame that these methods are not available when an O/S is installed.

    The algorithms that concern the data types should also be available along with the data types. This means that an operating system not only should provide data management, but it should be object-oriented: each "data node" in the system should be available as a class in the chosen programming language (if it supports such a concept).

    The availability of data and their types on the O/S level would also boost security and safety, as it would not be possible for a 'devious' application to approach the data in any other way other than the intended one.

    Finally, the concept of 'application' is also wrong, and I am saying this in the context of data: in our day and age, data not only multiply fast, but the types of data are frequently modified. The liquid status of data (and their data types) makes the concept of an 'application' (thousands of source code lines, cast in the stone, with a huge degree of coupling between them) a huge obstacle in really making computers useful. Applications need to be replaced by a live system of persistent objects that do simple jobs and inform the world (through events) about changes in their state or the results of their computations; the O/S should be responsible of organizing how objects communicate with each other (either in the same memory space, in different memory spaces, or in different computers).

    Since the current situation is not exactly orthogonal (as described above), there are many misunderstandings and problems in defining concepts clearly; many thousands of dollars are spent in re-inventing the wheel, and many work hours and brain power is consumed in creating what should already be there...(and thus we can have a nice /. discussion when half of the posters say that SQL sucks and the other half saying that XML sucks!)

  42. Re:Relational does NOT have to be "hard" by perlchild · · Score: 2, Interesting
    You quote imprecisely in this.

    I was saying
    1) a) Just how much more power could we get?
    is beyond my mere predicate logic skills at this time.

    Explaining just what power is missing from SQL to explain "the full power of relational models" in the context of the article, where it is said relational algebra can represent tree-like structures etc... is beyond me.

    I am not interested in how hard relational is to use.

    1)a) was referring to expressing, just what's missing in all the SQL servers, that could be reached if they were truly relational. In this case it has a lot more to do with how we define what you can AND on, a lot more than what operations you can use. I can understand AND just fine, I have a lot more problems with understanding how the experts say on one breath "it's not flat tables anymore" and on the next, no explanation on what operations you can use on a non-flat table... Say is the AND of a pair of arrays of floats the matrix product of the ands of the arrays? In what precision? Or are they just saying "the tables aren't flat, they can be linked" but you gotta restrict your operations on the virtual flat tables that overlay your more esoteric structures?

    ADABAS D had arrays and such(it's now MySQL MaxDB I believe) inside sql-addressable tables, but that was a relatively poorly supported feature, once which wasn't well modeled( you can see from my examples why it wasn't well modeled, I think, it brings up questions about the domains of each operation)

    We can certainly agree on the lousy marketer and packager, but you know what? The marketers won't help you write your complex queries either, Codd's theories just might(well again, they might not, but that's what the original post was about).

    I'm sure I misunderstand more about predicate logic than you've understood in the time it took you to read these lines, but I was aware of those limitations, and kept my post in line with that.

    You however chose to limit the relational model's power, to the logical operators it uses, without mentioning that the relational model also includes rules on how you can organize what objects you can apply those operators TO, which is a rather important distinction, and probably closer to weaknesses of SQL, as evidenced in the article anyways. Anyone can write relational algebra if you got scalar booleans, but if you got an array of complex numbers to multiply by a matrix of floats, and all that needs union(or any other type of join etc...) with userids, full names and addresses, it gets a little bit more fun.

    Thus, we extended the "language" of Boolean to closer match human language. As long as our extensions are defined using the primatives and don't break the rules of our system, we can have our cake and eat it to. True Boolean geeks can still use NAND if they want.


    Well "the rules of our system" also include just what we can NAND (or AND or XOR) ON, not just those operations. The definition domain of those operations is also important, that's why in SQL's fuzzy logic, ANDing with a NULL gives you a NULL.
    Now if there's an impedence mismatch between sql and relational theory, it's probably on the definition domain of the operations(NULLs, non-scalars values, strings) and not on AND itself, which is pretty much a "simple" operator, at least when you limit yourself to scalar values like booleans, and logical predicates.
  43. Oh dear by Ankh · · Score: 3, Informative

    I'm not going to try and reply in detail, but since I participate in the W3C XML Query Working Group and am also the w3C XML Activity Lead, a few comments may be useful.

    The article seems to says "I don't like SQL and I don't like XML and I think XML Query is about mergin them although I don't understand it very well, so the people working on XML Query must be stupid, and in any case it's easier to attack people than understand a specification".

    Perhaps that's unfair, but it's clear to me that the writer is a little fuzzy on the design goals of XML and also on the focus of SQL development over the past 10 or 15 years.

    In both cases the story is about interoperability.

    If you look at the XML Query Home Page you'll see approximately two dozen implementations of the XML Query draft, including a number of open source ones. If you look at the public mailing list for comments, you'll see we received over 1100 detailed technical comments at the last public review. So there's a lot of interest in this work.

    Why is that? One reason is that, like Web services and SOAP, XML Query is able to replace a lot of proprietary and hard-to-maitain middleware. Another reason is that for the first time we'll have a standard way to search over multiple kinds of data source.

    Don is the primary editor of the XQuery language, but the technical decisions reflected in the specification are a result of collaboration, and are agreed on by aconsensus process by a much larger number of particpants. The goal is to make a language that people agree to implement and to use. With support announced by Microsoft, Oracle, IBM, BEA and others (see Web page mentioned above) and judging by the public interest, I think it's fair to say that's going to happen.

    It's pretty rare to see a large complex system that everyone is happy with. It's actually pretty rare to see a small system that everyone is happy with. There are people who are unhappy with some features in the Unix cat program, but it's better to have cat in every Unix system than to have millions of shell scripts break on systems where it's missing! The trick, then, is often to include features that will lead to massively wider adoption, even if some people would rather be without them.

    Then we have (as part of W3C Process) a public call for implementations so that we can test to see how confident we are that all the major features can be implemented compatibly (i.e. interoperably) in multiple independent implementations.

    Features that were not implemented get removed before the specifications are final.

    Is XML Query a waste of time? Is XML evil? Is SQL evil? A lot of people think otherwise, and some of them are pretty smart, so if you are concerned, take the time to read the specs and decide for yourself. :-)

    --
    Live barefoot!
    free engravings/woodcuts
  44. Ok SQL is wrong...and?? by cjb110 · · Score: 2, Informative

    I've read the article (maybe i've misread it but its 8:30am and a saturday:)) and although I can see lots of bashing of SQL, XML and nulls going on I can't see any 'alternative' or solutions suggested.

    --
    ----- I refuse to have an argument with an unarmed person