tiero - Fotolia


Compare Google Cloud Firestore and Firebase Realtime Database

Managed NoSQL databases are increasingly popular for app development. Compare two such options from Google -- Realtime Database and Cloud Firestore -- to see if they meet your needs.

NoSQL databases have proven their value for many application types that depend on large unstructured datasets, rapid development and resilient deployment.

There are numerous cloud-hosted NoSQL database services to choose from that can complement most enterprise-class workloads. Mobile and web application developers that use Google Cloud Platform can choose between Firebase Realtime Database or Google Cloud Firestore database.

Let's highlight the basic features of each NoSQL database and consider which might be the best alternative for your next application development project.

The basics

Firebase Realtime Database is Firebase's original hosted NoSQL database. It stores data in the JavaScript Object Notation (JSON) format and provides that data in real time. The database is primarily intended for mobile and web app development. Developers can use Android, iOS and JavaScript SDKs, as well as REST APIs.

Google Cloud Firestore is also part of Firebase's portfolio and is a flexible, scalable, hosted NoSQL database that is better suited for demanding, complex applications. This newer offering provides a few additional features and more functionality compared to Realtime Database. For example, like its predecessor, Cloud Firestore is used to build mobile and web apps using SDKs for iOS and Android, but it can also be used for server-side development through Node.js, Java, Python, and Go SDKs, as well as REST and RPC APIs. Because of this, Firestore is best for newer application development projects.

The similarities and differences

Choosing the right NoSQL database depends on your real-time data synching needs and your app requirements. And while both databases share some similarities, it is important to know what makes them different.

Data Structure

Each NoSQL database stores data in different ways. Firebase Realtime Database stores data as a large JSON tree, which is a group of JSON documents. This works well for handling simple data, but it can fall short if you need your database to organize large amounts of data or handle data in a hierarchical manner.

Google Cloud Firestore uses documents and they contain fields that map to actual values. These documents are then stored as collections and sub-collections, which can be organized to gather related data or facilitate database queries. The database can support many types of data -- even nested objects and complex hierarchical data structures.

Offline support

Firebase Realtime Database supports an offline mode in which persistence is maintained through a local cache, even when the application is disconnected from the internet. The database is automatically updated and synchronized with its instance once the application reconnects to the internet. This way, the application can continue to function even when network access is slow or intermittent.

Google Cloud Firestore also provides an offline mode that caches data to the client and enables apps to continue to read and write to the database without internet access. However, it also integrates with other Google Cloud services, such as Cloud Functions, as well as open source libraries. This gives more versatile actions and flexibility in application design -- only changes to the database are exchanged during synchronization.


Firebase Realtime Database is built to handle unstructured data with rules language called Firebase Realtime Database Security Rules. The rules define the data structures and controls how data is written, read, validated and indexed. IT teams can also use them in conjunction with Firebase Authentication, which enables control over data access at the user level.

Google Cloud Firestore also uses its own rules language called Cloud Firestore Security Rules. As with Realtime Database, rules can provide granular protection to database contents and access. These rules can also be used in conjunction with Firebase Authentication for mobile and web applications, and enterprises can use Google Cloud Identity and Access Management for server-side languages, too.


Firebase Realtime Database can sort or filter, but not both. Queries can be granular, but queries will return the entire sub-tree, which delivers more results than necessary. While the database does not require indexing, this can impact performance in large data sets. By comparison, Google Cloud Firestore supports more complex needs, such as indexed queries that simultaneously sort and filter to refine search results.

Write and transactions

Firebase Realtime Database uses simple writes and transactions. Data is written through dedicated sets and regular update operations. Data is also saved through transactions. Google Cloud Firestore adds flexibility to writes and transactions, writing data with sets and updates, as well as enabling more complex operations with transformations. Transactions can also be read and written to any part of the database, whereas Firebase Realtime can only use transactions on a specific data sub-tree.

Reliability and scalability

In terms of reliability and performance, Firebase Realtime Database provides extremely fast operations, but the database is limited to the availability zones of a single region. Also, the database will need to be sharded across multiple instances if it exceeds 100,000 concurrent connections and 1,000 writes per second.

By comparison, Google Cloud Firestore offers the reliability of a native multi-region service. Also, it is more scalable with current limits of 1 million concurrent connections and 10,000 writes per second -- and that is expected to increase in the future.

Other options

Regardless of your choice, Firebase Realtime Database and Google Cloud Firestore are not mutually exclusive. Firebase developers can certainly use both databases together in the same project. But there are also many other non-relational database offerings in the public cloud arena including:

  • Amazon DynamoDB;
  • Amazon DocumentDB;
  • Azure Cosmos DB; and
  • Azure Table Storage.

Your database choice will primarily depend on the needs of the application and the types of data that it needs to handle.

Dig Deeper on Cloud provider platforms and tools

Data Center