tags:

views:

964

answers:

5

Are there disadvantages of using XML, instead of RDMS? The reason I ask this is because my data is more naturally represented by XML structure, rather than RDBMS. I initially thought of storing the data in relational database, but the lack of flexibility of relational database to handle tree-like data structure was putting me of. So I am thinking about just storing the data in XML.

One thing I fear is performance penalty. While RDBMS can handle large datasets, I am not sure whether the same can be said about XML. Also, the database queries are pretty well-established and fairly easy to use and construct, what about XML queries? I don't know.

I am doing .Net application.

A: 

Two big inherent advantages of RDBMS are:

  1. Indexing. Greatly enhances performance.
  2. Constraining. You can define relationships between elements which helps maintain the integrity of your data.

Keep in mind you can put xml in sql server and query it using xpath, so depending on the shape of your data, you may be able to get the best of both worlds.

bingle
+1  A: 

In my opinion, these are the factors to consider

  1. Which fits your applications needs more closely
  2. How large a data set you need to handle?
  3. Are you transferring data between applications or are you going to query it?


Once these factors are considered, I would suggest that you decide to use RDBMS, if you have large data processing and querying needs and XML if you need to export data or transfer it between applications. i would also like to suggest that you consider constraints on your data and integrity needs like Nick has suggested.

I have little experience in the area, however this is what I have heard from others at my school.

All the best.

batbrat
+3  A: 

You should not compare XML with an RDBMS, since that are 2 complementary technologies; XML should not be considered, or regarded as a replacement for an RDMBS.

An RDMBS is for storing large amounts of data in a consistent way. The RDBMS should take care of the consistentcy of the data, etc ...

XML can be used for data-exchange between different computer systems for instance, but it should not be used to store large amounts of data over a long period of time.
Xml doesn't allow you to take care of data-consistency like an RDMBS does; it doesn't take care of transactions, etc... Xml is actually nothing more then a text-file, that contains data in some kind of structured way.

Frederik Gheysels
+1 - it's more like comparing DBs with Files
annakata
A: 

You can have the best of both worlds, your data can be stored in the database, and that has to be a better solution. As a DB is faster, more secure, has backup and restore, rollback, admin tools and so on ....

It sounds as though your data is hierachial in nature, databases can be coerced to store hierarchies without too many issues.

When it comes to using your data if you extract it as Xml. I know if you're using Sql Server that works out of the box, not so sure for Oracle.

MrTelly
A: 

Things an RDBMS provides that XML doesn't, more or less in order of importance:

  • enforcement of a defined schema (though this is certainly available to XML)
  • support for multiple writers
  • atomic transactions
  • referential integrity
  • well-defined query language
  • ability to optimize access through indexes, compiled queries, etc.
  • role-based security
  • triggers, stored procedures, calculated columns, etc.

Plus you don't need to load the entire database into memory before you can access any of it.

XML's an okay serialization format for an object model. It's good for hacking together relatively free-form data models that you can access with XPath, too - especially if you're going to transform that data into XML or HTML via XSLT. And it has the merit of being standard and platform-independent.

But if you get too ambitious with it, you swiftly get into the kind of territory that results in you writing rants about how terrible XML is. (I'm talking to you, Jeff Atwood.)

Robert Rossney