android db (SQLite, Realm or Redus)

phamduy.uit

Senior Member
Oct 3, 2017
109
45
28
Hi smauh117, this is my opinion:

Persistence - why Realm, not Room (SQLite)?

Room Persistence Library is a part of google's android acrhitecture components announced Google IO 2017. It provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite, works well with LiveData.

But, SQLite is not simple, and relational database is not easy for a lot of android developers. In almost android application, local database is offen used for data caching only, and isn't center of bussiness processes.

Realm is a mobile database, a replacement of SQLite and ORMs. It is much more simple than SQLite, but really powerfull, easy to learn in minutes, not hours, for every mobile deveopers, both Android and iOS. Even "Realm Database is much faster than an ORM, and often faster than raw SQLite". With lazy data loading, your app can easy to archive better performance and user experience, it's really difficult if you are using Room.

Room works well with LiveData and lifecycle aware to prevent memory leaks, how about Realm ?

It dosen't matter, Realm can easy to adapt with LiveData, read more: Android Architecture Components and Realm.

For full article and source code, please visit my project here.


I also created this project to compare Realm and SQLite (with ROOM). Please checkout different branches.
 

NiftyUI

Member
Sep 24, 2018
14
37
0
I have a to chose between those Database :SQLite, Realm or Redux
witch one is the best for regular db update ?
AFAIK: Redux is an architectural pattern and not a database like Realm and what do you mean by "regular db update" ?
Anyway, Google's Room is a pretty good and established abstraction layer over SQLite on Android. I don't recommend Realm because there're a couple of pitfalls regarding multithreading. If you don't want to use SQLite + Room check out Objectbox.
 

@MJT

New member
Oct 15, 2018
2
0
0
Syndey
I have a to chose between those Database :SQLite, Realm or Redux
witch one is the best for regular db update ?
SQLIte/Room may not be the best option depending upon what you actually mean by regular db update.

That is SQLite and therefore Room (Room being an abstraction layer over SQLite) is intended as an embedded database and thus each device has it's own distinct database and synchronisation with external data would have to be coded/developed, just pulling data from one source wouldn't be overly difficult. However, two/multiple way/device synchronisation would introduce complexities and hence why many solutions use other databases that are intended as a client server solution (e.g. MYSQL for example).

Firebase, not that I've used it, could be a solution as this is a client/server solution and is designed for Android use.

Personally I find native SQLite easier and therefore faster to use than Room. I've never used Realm.
 
Last edited:

soora

Member
Dec 1, 2018
16
1
0
London
it depends on your data architecture, if you'd like to use a non relational database just go with Realm, it's like mongo for mobile apps, otherwise there is Room, which represent the relational database by using Sqlite.
 

biunsan

Member
Apr 27, 2019
12
0
0
SQLIte/Room may not be the best option depending upon what you actually mean by regular db update.

Personally I find native SQLite easier and therefore faster to use than Room. I've never used Realm.
I completely agree. I use SQLite to save user preferences in the application. It is simple and stable.
And this is a cross-platform solution (not only for android).