An XML file or Database?

Posted by webnoob on Programmers See other posts from Programmers or by webnoob
Published on 2012-04-04T15:27:29Z Indexed on 2012/04/04 17:41 UTC
Read the original article Hit count: 478

Filed under:
|
|
|
|

I am re-writing a section of my site and am trying to decide how much of a rewrite this will be. At the moment I have a web service feed that generates an xml once per day. I then use this xml file on my website to generate the general structure. I am trying to decide if this information should be located in the database or stay in the xml file.

  1. The file can range from 4mb - 12mb.
  2. The files depth can go on and on so I have to recurse to find the data I want.
  3. I use the .NET serializer classes and store the serialized file in a global variable to avoid re-serializing it each time the page is loaded.

My reasons for thinking a database would be better are:

  1. I would know exactly where I am in the file by using an internal ID so I wouldn't have to recurse the file to get information.
  2. I wouldn't have to load / serialize the XML and could just use my already open database connections.
  3. Searching for the data in the file would be quicker(?) as I would just perform an SQL query rather than re-cursing the file.

Has anyone got any ideas which is better and which option uses more resources on the server or be quicker?

EDIT: The file is read every time the web page is loaded (although only serialized once). It isn't written to by standard users (only by an admin task that runs in the middle of the night).

This is my initial investigation before mocking up.

© Programmers or respective owner

Related posts about c#

Related posts about database