Firebase Database Vs MySQL Comparison

Firebase vs MySQL Database

In this article, I am going to share all about Firebase and MySQL. Compare Firebase vs MySQL and choose what should you use.

SQLite is local database on Android device (data stored/processed on a device) with SQL interface.

FireBase is a cloud service. FireBase is a NoSQL database. Data stored/processed in a cloud. To access them device need internet connection (yes “…When your users go offline, the Realtime Database SDKs use local cache…” but only _cache_, what about further conflict resolves ?)

in terms of CAP theorem Firebase & SQLite placed on a significant different corners of “CAP triangle”.

SQLite is a legacy, it is independent & absolutely free. FireBase comfortable for rapid development but it is a third-party service (Firebase Pricing). At any time in future (only google decide when) it may be closed. So it’s a unstable dependency, be careful.

SQLite is just the datastore where you’ll store and retrieve the data and also it’s not a distributed database where if you want to share data between multiple users you can’t do it with SQLite.

Firebase is a distributed database and it gives realtime streaming support. But again it depends on the usage, if you want a simple offline only app you can use SQLite but if you want to build a distributed data app go with firebase.

There is a significant difference between SQLite Database and Firebase. Firebase is a real-time database whereas SQLite is in-process database. Real time data processing means a continual input, process and output of data. Data must be processed in a small time period (or near real time). Immediate actions are performed by the real-time databases.

Q: Am I correct in saying Firebase is a hierarchical data structure?
A: Firebase is indeed a hierarchical data structure: it’s really just a JSON tree in the cloud.

Q: How can data be represented in ERD and Database tables to show the data structure of firebase?Q:
A: there is no defined way to display hierarchical data in an ERD. It’s more common to show a JSON tree.

Q: Does Firebase uses primary and foreign keys like in MySQL
If so, are these represented in the same way like in when designing ERDs and tables for MySQL database?
A: Firebase has the concept of keys, which are the names of the nodes that you store data under. You could somewhat compare those to the primary keys of a relational database. But there is no concept of a managed foreign key.

Q: How / what is the best way to structure data in Firebase and show these in ERD and tables?
A: as your second question: it is a common practice to model your Firebase database as JSON, which is quite convenient as that’s also the format that the database stores.

Leave a comment