Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
XML vs SQL for small projects?

I'm making a (conceptual) system to simulate any kind of sports match (like soccer,basketball,etc) with actions (for example pass,pass,out,pass,score) so it will be like a real report. The main statistics (play time, number of actions etc.) I'm saving to a MySQL database, but the report itself, can contain more than 1000 actions per match.

To avoid millions of records in my database I'm thinking of saving the detailled report in a SQLite database or a XML file. For every match played, a file will be created. When a user request the match details, I read the file for details.

What is the best choice for this purpose? SQLite or XML?

share|improve this question
    
Impossible to say, start with the approach you think it may be easier to develop for you and see how it works. –  Doc Brown Jun 13 '12 at 8:43
add comment

marked as duplicate by Glenn Nelson, Walter, gbjbaanb, gnat, Yannis Rizos Jun 13 '12 at 16:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

The thing with databases is, they are built for storing millions of records. Unless you have good reason not to, simplest solution would be... to store detailed match information in MySQL database itself.

SQLite is most likely good option if your application doesn't need one, global database but instead realies on local data stores (which doesn't seem to be the case). Something like application configuration, local user settings or private data. Being database aswell, SQLite is also good at storing millions of records. If you wish to, you might just aswell migrate entire thing to SQLite.

Finally, I'd advice against storing match data in XML. XML files usually take longer to process (but are more user-friendly), but indeed are often used to store generated reports. However, those reports base on some existing data - in your case that would be match details, which has to be stored somewhere. Generating XML report from data in XML doesn't really sound like thing to do, hence my advice.

Also, using database as storage (as opposed to XML file) will enable you to easily generate different content from the same data. Now you want reports - fine, this can be easily built (even to XML file) using content stored in database. Later you might need shortened report, or only report from first 15 minutes, or split in halves, anything. It might be easier to build those things using data from database, than in XML. Think of a XML in this case as end product (report for user), while raw database rows - something that lets you create those end products.

share|improve this answer
add comment

When the data that is being generated need to be further processed or used as data (i.e. for more reports or presentation) then store it in a Database. If SQLite isn't faster enough for millions of rows then use another database. SQLite should be ok, ref What are the performance characteristics of sqlite with very large database files?)

If the data you are generated will only ever be viewed and the processing that is performed on this data is styling, layout and filtering then XML is better.

If you are having trouble storing something efficiently in a database then the chances are that your data modelling is faulty.

Databases are really good at storing and indexing large amounts of data, XML isn't.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.