Firebase has emerged as one of the most used database used which is gaining more probability day by day. Well, firebase has every reason for the developer to choose it. Before moving into the advantages that firebase as a whole has, let's first look into the types of databas it provides. Firebase offers two cloud-based, client-accessible database solutions that support realtime data syncing. These are :
Realtime Database is Firebase's original database. It's an efficient, low-latency solution for mobile apps that require synced states across clients in realtime. Originally, firebase used to offer Realtime Database for the applications. But soon the apps running on firebase began to increase and scalability of this database became an issue.
Cloud Firestore is Firebase’s newest flagship database for mobile apps. It is a successor to the Realtime Database with a new and more intuitive data model. Cloud Firestore is richer, faster, and more scalable than the Realtime Database.
The choice of database will depend on many factors. But let's look into some key considerations to look into that might help you decide the better type for you. The key concepts that I personally look for are Scalability, Querying, Availability & Pricing. So the complete idea will broadly revolve around these concepts.. If you want to go deeper and look into each and every aspect, there is no better place than the Firebase Docs itself. Read the complete guide here.
Taking reference from the official docs, Realtime Database scale to around 200,000 concurrent connections and 1,000 writes/second in a single database. Scaling beyond that requires sharding your data across multiple databases.
Even though 200,000 concurrent conn and 1,000 w/s is a considerable amount but needing that extra step of sharding to scale it further must be kept in mind
Scales completely automatically. Currently, scaling limits are around 1 million concurrent connections and 10,000 writes/second. We plan to increase these limits in the future. There is no denying the fact that the first thing that Cloud Firestore solved was this issue of scalability.
We plan to increase these limits in the future. - Firebase Doc
The ability of the database to be able to perform complex queries has always been a game changer for me. You never know the complexities your database might hold or the kind of scalability you might reach. You must always go for cloud firestore if your app has the possibility to have complex data in future or you want to perform complex queries over your data.
Here is a snapshot taken from Firebase Docs to help you out.
Availabily is not an issue for either of the databases as both of the databases promise at least 99.5% of uptime.
The best thing about Firebase! Try either of the database of your liking without requiring to pay a single penny! Firebase is free to try for anyone and they provide some great offers and value in the Spark Plan which is totally free of cost.
Previously Firebase used to have three plans namely Spark, Flame and Blaze. Now they only offer two plans.
Spark Plan works like a charm for any personal projects that does not demand high requirement. I personally use it for my personal projects. To know more abou the pricing and plans, go to this link.
We can safely say that for any small project that does not demand any considerable scalability or complex querying, we can go with the Realtime Database. For complex applications like an E-commerce applications, go for the Cloud Firestore without any second thought. Data Organisation is much better and easy to understand for complex data in Firestore. Hope this comparison helps you out in deciding which database to choose for your app.
Models are the core of the data flow in any of the MVC architecture. Learn how to make models in Flutter/Dart in a professional way....
Let's create a Clean and Materialistic UI Design for Login and see how we can implement google signin using Firebase Auth...
In this video we will learn about fetching data from the Internet. Learn to make API calls from your flutter application...
A complete guide on using PageView and PageController in Flutter....