Realtime Database vs Cloud Firestore - Which database to choose ?

26 Jun 2020 | Saheb Singh Realtime Database vs Cloud Firestore - Which database to choose ?

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
  • Cloud Firestore

Realtime Database

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

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.


 

Realtime Database or Cloud Firestore ? - How to decide

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.

Read the official Firebase Docs to know about all the other aspects
Go to Firebase

1. Scalability

Realtime Database

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

Cloud Firestore

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

2. Querying

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.

Firebase Realtime vs firestore queries
credits - firebase.google.com

3. Availability

Availabily is not an issue for either of the databases as both of the databases promise at least 99.5% of uptime.

Well! A promise of at least 99.5% uptime is no joke! Kudos to Google.

4. Pricing

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.

Firebase - Get Started
credits-firebase.google.com

Previously Firebase used to have three plans namely Spark, Flame and Blaze. Now they only offer two plans.

  • Spark Plan(Free)
  • Blaze Plan(Pay as you go)

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.



Conclusion

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.

Happy Coding!

the growing developer
Hi, my name is Saheb Singh , I am a A Software Engineer by Profession. I love to spread the knowledge I gain.I make tutorial videos on Youtube and write blogs for the same.

More blogs related to Flutter

Understanding Bloc in Flutter | The Easiest Guide

Understanding Bloc in Flutter | The Easiest Guide | Flutter

28 Mar 2024 | Saheb Singh

It's been over 2 years since Bloc was mentioned with respect to State Management in Flutter. While it is now widely used in some of the biggest applic...

How to create models in Flutter | Dart? A Beginners Guide

How to create models in Flutter | Dart? A Beginners Guide | Flutter

28 Mar 2024 | Saheb Singh

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....

Flutter Tutorial - How to build Beautiful Login Screen with Google Sign - Part I

Flutter Tutorial - How to build Beautiful Login Screen with Google Sign - Part I | Flutter

28 Mar 2024 | Saheb Singh

Let's create a Clean and Materialistic UI Design for Login and see how we can implement google signin using Firebase Auth...

How to fetch data from Internet | Flutter API Integration

How to fetch data from Internet | Flutter API Integration | Flutter

28 Mar 2024 | Saheb Singh

In this video we will learn about fetching data from the Internet. Learn to make API calls from your flutter application...

PageView and PageController | Flutter Tutorial for Beginners

PageView and PageController | Flutter Tutorial for Beginners | Flutter

28 Mar 2024 | Saheb Singh

A complete guide on using PageView and PageController in Flutter....

© copyright 2020. All Rights Reserved.