An XML file or Database?
- by webnoob
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.
The file can range from 4mb - 12mb.
The files depth can go on and on so I have to recurse to find the data I want.
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:
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.
I wouldn't have to load / serialize the XML and could just use my already open database connections.
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.