Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello to all.
Imagine a server processing plenty of users' data. It has to save them, store, use and send something as a request. What way is technically better: to store the data in XML format (a single file per user or one file for all the users) or to store data in tables in a DB (a table per each user or a table per user)?
Pros and cons?
Thanks)
Posted
Comments
Kornfeld Eliyahu Peter 9-Aug-15 8:42am    
It is not a theoretical discussion - to decide what storage to use, you have to face an actual problem to solve...
Then you can see the volume and type of data you have to handle, the nature of the queries you run, and on and on...After that you can pick up a storage model (and there are more than two you may chose from)...
John C Rayan 9-Aug-15 8:43am    
By knowing the requirements only we can decide. See the comments from Kornfeld Eliyahu Peter
sreeyush sudhakaran 9-Aug-15 9:02am    
if you have small amount data which is only used for short term storage xml is a good option , if you have bulk amount of data and need bulk data processing don't even think about xml it is very heavy go for sql.
[no name] 9-Aug-15 9:08am    
Even if you - for any reason whatsoever - come to the conclusion that XML is the best solution for your problem ... I would also store XML in a database. A database gives advantages like transactions, backups and more.

Technically, there is no answer to your question.

To tell you something valuable, one have to know what is your users data, the usage and plenty other details.

And the answer can be neither of the 2 possibilities.
 
Share this answer
 
v2
It's not a "this is better, this is worse" comparison: they are designed for different purposes, and and "better" or "worse" will depend on how they are being used, rather than any intrinsic benefits from the storage medium. It's like asking "which is better, bananas or oranges?" - it depends. If you are cooking a duck, then duck and orange is a classic combination. If you are making a sandwich, then banana can be a good filling for children.

For example, if you are expecting multi user access, then you want a server-based DB. using an XML file will cause huge problems!
If you want a configuration file which is used once when you app opens, then the overhead of an SQL database is just silly - though an SQLite DB could be a good idea.
If you want to update it often, inserting and deleting rows, than any text-based (such as XML) is going to perform relatively badly.

And so on - each are good solutions, but it depends what the question is as to which is appropriate!
 
Share this answer
 
Comments
Dzianis Igaravich Leanenka 9-Aug-15 12:17pm    
To tell the truth the main goal was to keep users' data for some purposes, but not to keep them as configuration files, hence I see it worth to use a DB, it would be better for huge number of operations like write, rewrite, store, delete data.|Thank you all. I appreciate it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900