DataSet vs XML storage

  • Thread starter Thread starter PV
  • Start date Start date
P

PV

Hi everyone,

I've heard some (I think wierd) ideas that it is much faster to use
XmlDocument then DataSet for storing and updateing data from database. The
idea is to use XmlDocument to store data, make add/update/delete operations
on it, keep track of changes and finally make changes into database. It
assumes that one have to write all methods that will perform these actions
on XmlDocument that will act as DataSet.

Does anyone has experience with this and what are real performace issues on
this?

PV
 
Dear PV,

Among things to consider is definitely the number of records that you would
have to store.
Remember that Xml are nothing else than structured flat files, without any
indexing strategies, or storage optimization techniques.
Now it's true that creating/maintaining a database for only a few number of
records is maybe a big overhead, since you can somewhat mimic a database
with DataSets (which are in a nutshell a collection of tables), which can be
created straight from Xml Files.

I hope this gives you more clarifications on the subject.

Selim
 
PV:
PV said:
Hi everyone,

I've heard some (I think wierd) ideas that it is much faster to use
XmlDocument then DataSet for storing and updateing data from database. The
idea is to use XmlDocument to store data, make add/update/delete operations
on it, keep track of changes and finally make changes into database. It
assumes that one have to write all methods that will perform these actions
on XmlDocument that will act as DataSet.

Does anyone has experience with this and what are real performace issues on
this?

PV

PV:

I think that there are many factors here that could affect performance so
it's not an either/or situation across the board. For instances with small
record sizes, I have found that the difference is trivial if not
indistinguishable, although admittedly I haven't tried to replace DataSets
with XMLDocument as such.

I do think however that overall the XMLDoc approach would have to be a whole
lot faster for me to pass up the dataset b/c DataSet's can do quite a bit
for you and maintainability of code and ease of use are not something to
take for granted. Also, I think that DataSets can do a lot in terms of data
integrity that would take a whole lot more work to do with XMLDocument.
Moreover, if speed is the primary concern, than XML may not be the way to go
at all. After all, you could use a Strongly Typed collection populated by a
DataReader and roll out your own logic and probably realize performance
gaines over both approaches.

Specifically though, it may be faster to use XMLDoc to load the data, but
Updating the DB is one of the more expensive operations in either scenario,
and provided the update logic is the same, I doubt you'd notice the
differences.

The bottom line really depends on how things are structured and the number
of records, and if speed is the primary consideration, there are probably a
lot of other things that can be done still using a DataSet to speed things
up. And remember that if you opt totally against using DataSets/DataTables
,then you are going to pass up some functionality and optimizations that you
probably don't want to pass up.

Can you post a little more about the specific situation at hand that you are
facing? I could probably get a lot more specific then.

Cheers,

Bill
 
I have an application that has 8 tables in it. One of the tables has about
1000 rows with 10 fields in it. The other tables have a couple of hundred
entries in each one with 8 fields each.

Using MDAC, Microsoft access, it takes 8.5 seconds from the time I start the
application to the time the DataSet is Loaded using DataAdapter.Fill
commands. Using XML and the ReadXML command it takes 4.9 seconds. Once the
data is loaded into the Table both handle data the same way so I don't see
any difference in speed.

I say all that to say this. I was very suspicious on using XML because I
was concerned about speed. But I am very pleased with the speed that I am
seeing.

I think one of the advantages of using a dataset is that you have datatables
and dataviews to work with. DataView Sort and Filtering features have
helped my project significantly. Of course you won't get all of these tools
if you use XMLDocuments.

One other plus of using XML over MDAC is that MDAC does not need to be
deployed.

So by using XML and a dataset you have the advantages of all the data
routines without the hassles of deployment.

Trey
 
Back
Top