none
How sluggish is a big xml file in combination with datasets? RRS feed

  • Question

  • Hello,

    I am currently working on a project which will run in an environment,
    where the size of the database is very limited. That's why I thought
    about relying in some parts entirely on xml files (and datasets) as an
    DB replacement.


    I.E.:


                DataSet myDataSetToRead = new DataSet();


                myDataSetToRead.ReadXmlSchema("c:\\abcd.xsd");
                myDataSetToRead.ReadXml("c:\\abc.xml");


    dostuff with the dataset data


    etc.


    Now, I will doing this only for the little used parts application,
    where maybe 5 users at once will use it.


    I know that this approach is slow compared to a real DB, but, what are
    the other limitations? Is there a size limit? I mean, will it somehow
    break after the file reaches 50 MB? And how much slower will it be,
    compared to a DB? 10 times slower? More?

     

    Sunday, October 21, 2007 3:09 PM

Answers

  •  

    Once you have the data loaded into a DataSet, the performance will be the same between a DataSet loaded from a XML file and a DataSet loaded from a database. If you loading the entire XML file (i.e., all data), then it's quite possible that XML will be faster. If you need to prequery your data, for example only load a subset, then a database will have a distinct advantage. One other advantage that a database has is that you can incrementally update it. An XML file needs to be completely overwritten, so even if you only change one value, all 50 MB needs to be streamed.  

     

    The size limit on a DataSet is quite large - 50 MB should not be an issue. However, loading and saving the entire DataSet will slow down as the file size increases.

     

    In addition, if you have multiple people loading and saving the XML at the same time, you will need to consider how to handle conflicts. Databases have built in technology to handle multiple writers, while the file system generally doesn't.

     

    Basically, using an XML file for a database replacement can make sense in some situations, especially when there is little updating.

     

    Thanks,

    Erick

    Monday, October 22, 2007 3:37 PM