• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML vs Database

 
ashish bhardwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking for views on this:

We have data of size 10 TB(terabytes), stored in multiple disks. Metadata (data describing data like filename, its location, author, description etc.) can go in GB(gigabyes) say 5GB. To develop a web based application, should metadata be stored in xml files or in a database like oracle, mysql etc.

Since data is going to increase in future, scalability is required. Which approach will give better performance?

Thanks
Ashish
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to extract data randomly from that 5 GB of metadata? Then don't make it a single XML document. That's completely unscalable. If it's amenable to being made into SQL data then I would do that. If it's less structured than that, then I don't know.
 
ashish bhardwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
It will be like a user wants to find data matching a particular criteria e.g. all files generated between specified start date and end date,
extracting required data and analysing it to give statistics, generate plot etc.

Will database approach will give good performance?
As xml file will be larger, so can't use DOM, but Is using SAX parser scalable and gives good performance?



Thanks
Ashish
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably performance is not the only criteria that should decide whether one should use database or not. There are whole lot of things database provides like transactions, management capablities, power of sql or similar query language, stored procedures and the list is long.
If you like it, there are many open source xml databases available today.
My personal opinion is having data stored in an xml and trying to read it yourself, for any big application will lead you into a point from where you will think "may be i should have used an xml database".
By whatever you have described, it looks like you are into some sort of reporting software that will definetly have a lot of different type of queries into the data and hence it will be a huge effort to write code to read xml without using xml database. It just makes the problem hugely complex if the size of data is of Terabytes or even GBs.
I would suggest(as Paul suggested) to go for database if possible otherwise atleast look at some good xml database to the least.
Do not venture into giving a shot at handling the xmls yourself!

[ January 29, 2008: Message edited by: Nitesh Kant ]
[ January 29, 2008: Message edited by: Nitesh Kant ]
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ashish bhardwaj:
It will be like a user wants to find data matching a particular criteria e.g. all files generated between specified start date and end date,
extracting required data and analysing it to give statistics, generate plot etc.

Will database approach will give good performance?
If your data model can be described as a reasonably small collection of tables, then a database would be a good approach. Databases have indexes and views which mean you don't have to read the entire database to find one piece of information.
As xml file will be larger, so can't use DOM, but Is using SAX parser scalable and gives good performance?
The SAX method won't use up all your memory, but you still have to read the entire XML document even if you want to extract one data element. And if you have a query that can't easily be answered by a single sequential scan of the database, then you have some hard work to do (which almost certainly would have been one line of SQL).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic