Question

I have a web platform that stores data for an application that I am building. The web platform is built with Ruby on Rails and the main app is for Android. I am curious to know about any performance issues of storing my data in an XML file (for the android app). Eventually my database in the web app is going to have about 2000 entries (like articles / Article category -> Article - content, description, title, image path).

Is it better to use SQLite or an XML file to store my data?

Was it helpful?

Solution

When data set is larger, SQLiteDatabase is the best option. CRUD operations performed on database would be much faster than parsing the xml files for data retrival.

To be more specific, database has the advantage of SQL as its query language, relational theory as its underpinnings, and years of optimization by vendors.

XML is little more than a data format that carries its own meta-data along with it. You can serialize it to and from disk, parse it into memory using standard parsers, and query using XPath, but it's not configurable or optimized to the same degree as SQL.

XML can be useful as a configuration format or a wire protocol or simple serialization to disk, but it's not a full-fledged persistence technology.

There are lots of NoSQL alternatives (JasDB) if you would rather not use a relational database. But I wouldn't consider raw XML as one of them.

Also, using XML may become unmanageable as the number of users grows. Using a database from the start ensures you have the room to expand and develop as your user base increase.

OTHER TIPS

I recommend to use SQLite for storing data for 2 reasons :

1) Easy to manage like (Insert,update,delete)
2) Anytime if table structure is changed easy to change and update accordigly.

Use SQLite to store enlarge data

I Recommend you to use SQLite, because its easy to use and manage data base. I can provide model .java file if you want to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top