[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: XML versus Relational Database
- From: Benjamin Franz <email@example.com>
- To: firstname.lastname@example.org
- Date: Mon, 05 Feb 2001 06:36:17 -0800 (PST)
On Mon, 5 Feb 2001, Dylan Walsh wrote:
> Kimbro Staken wrote:
> >Storing XML in a file or in a text blob in a RDBMS works fine as long as
> >you always treat the XML as one atomic unit and can handle the hit of
> >parsing the document each time it is retrieved from storage. If your XML
> >is static this works fine but if the application is changing the XML
> >then a more robust mechanism might be in order.
> Might their not be a greater hit in assembling all the DOM nodes, coming
> back in pieces, compared to reading the whole XML document in one database
> operation and parsing it in your application? There has got to be an
> overhead in reading/writing possibly thousands of items of data, using many
> queries, instead of a single read/write of a text blob.
It depends on the application. If your application requires 'dumping' the
source form of every node in the document every time, it is problaby a net
loss to keep in in a persistent DOM form. If, on the other hand, you
typically only access a small *sub-set* of the nodes (something that
becomes more and more likely as the XML gets larger), a persistent DOM may
be a serious speed enhancer. With a decent XML database, you should not
have to load the *entire* document node set to reach a particular node
(and even without index support, if the document is well-divided, the
average number of nodes that need to be examined to reach a node should
scale something like O(log n) vice O(n) for re-parsing the flat file.)
> Last summer I asked a question about how best to store XML in an RDBMS. One
> response likened the decomposition approach to taking your car apart every
> night when you park it, and rebuilding it in the morning.
Depends on your application. If all you are doing is tossing around the
'BLOB' without actually using it for anything (like towing a car - you
don't care if it actually runs or not) - true. If you are actually using
it in more than relatively simple ways, a better analogy is keeping your
car with the engine turned on, warmed up and ready to go.
... with proper design, the features come cheaply. This
approach is arduous, but continues to succeed.