Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android data storage, When to use SqlLite and when to use JSON, Linq alternatives

I have a few years of exp with webdev using .Net and C#... and one feature I really enjoy there is the linq-expressions for quering for data.. is there anything that simulair for Android using to query against JSONs or against the SqlLite database? (I guess im looking for a typed expression/query-framework).

And for my next question.. Which one of the JSON approach and the SQLLite approach am I supposed to use.. and when? I know this has been asked a million times.. but there doesnt seem to be any strict answers..

Is SQLLite for more complex querying and when Im having a bigger ammount of data, while JSON is used while having a smaller ammount of data and not very much querying is needed?

Could I store all my JSON data in the memmory for faster read/write access?..since I have heard that storing it in the storage/on disk might be a slow process.

But on the other hand I also have heard that SQLLite is slow in generall...

And finally.. when we are speaking of "slow" is it slow like, a single read/write looks up the entire application for a few milisecs or is it slow like compared to a in-memory-database that executes queries and stuff fast as lightning

like image 335
Inx Avatar asked Dec 12 '22 16:12

Inx


2 Answers

When to use SQLite

SQLite is one form of how to persist your data, how to secure your data. Generally if you want to store larger quantum of data and have quick access to them(and also if these data are "sensitive"), SQLite is great choice. Hence i disagree with your opition that SQLite is slow, definitely not i guess.

I have SQLite database with approximately with 650 000 records and still smart performance(an usage of indexes is sometimes necessary).

When to use JSON

JSON is lightweight data structure designed for human-readable data interchange and what is main is language-independent. It's very good choice(maybe the best) if you want send data via network(send data to remote server etc.) but i think not very good for data persisting also it's not safe as SQLite is.

Generally you should compare JSON with XML but you can't compare SQLite and JSON which are two different things.

like image 175
Simon Dorociak Avatar answered Dec 21 '22 09:12

Simon Dorociak


General Idea

SqlLite : For Local Storage

JSON : For Server SideStore

like image 28
Nirav Ranpara Avatar answered Dec 21 '22 09:12

Nirav Ranpara