Google Cloud Firestore

From Luis Gallego Hurtado - Not Another IT guy
Jump to: navigation, search

A scalable, fully-managed NoSQL document database for your web and mobile applications.

Good for semi-structured application data, hierarchical data and durable key-value data.


  • Fully managed, serverless database that effortlessly scales up or down to meet any demand, with no maintenance windows or downtime.
  • Built-in live synchronization and offline mode make it easy to build multi-user, collaborative applications on mobile web, and IoT devices.
  • Firestore allows you to run sophisticated ACID transactions against your document data.
  • Libraries for popular languages.
  • Integrated with Firebase Authentication and Identity Platform, to enable customizable identity-based security access controls.
  • Data validation via a configuration language.
  • Automatic multi-region replication and strong consistency: 99.999% availability.
  • Datastore mode: it supports the Datastore API, expecting same performance characteristics and pricing with the added benefit of strong consistency.
  • Schemaless: it does not support for join operations, inequality filtering on multiple properties, or filtering on data based on results of a subquery.
  • Optimized for Online Transaction Processing (OLTP). For Online Analytical Processing (OLAP), use BigQuery.
  • Encryption at rest
  • Automatic autoscaling: automatically distributing data.

Data Models

Cloud Firestore stores data in collection groups, documents, fields and document ids (similar to tables, rows, columns and pks in relational databases).

Entities of the same kind can have different properties

Different entities can have properties with the same name but different value types

Firestore modes

Cloud Firestore in Native mode

New features, designed for use for mobile and web apps:

  • A new, strongly consistent storage layer
  • A collection and document data model
  • Real-time updates
  • Mobile and Web client libraries

Scalability: it can scale document update operations up to 10k writes per second and more than 1M connections.

Cloud Firestore in Datastore mode

In the Cloud Console, the database will use the Datastore viewer. It disables features not compatible with datastore:

  • The project will accept Datastore API requests and deny Firestore API requests.
  • The project will use Datastore indexes instead of Firestore indexes.
  • You can use Datastore client libraries with this project but not Firestore client libraries.
  • Firestore real-time capabilities will not be available.

It removes cloud datastore limitations:

  • Eventual consistency: all Cloud Datastore query become strongly consistent.
  • Transactions no longer limited to 25 entity groups.
  • Writes to an entity group no longer limited to 1 per second.

Scalability: it can scale document update operations up to 10M writes per second.

Cloud Firestore or Datastore

Cloud Firestore takes the best of Cloud Datastore and Firebase Realtime Database.

Cloud Firestore storage layer is backwards-compatible with Cloud Datastore but new features of Native Mode are not.

Cloud Datastore

Same than Cloud Firestore except:

  • Balance of strong and eventual consistency. Strong consistency for keys and sister queries.
  • High availability: regional with 99.9% and replicated multi-regions with 99.95%.

Cloud Datastore Data Model

Cloud Datastore stores data in entities, properties and kinds.

Use Cases

  • User profiles
  • Product catalogs
  • Game state

For extremely write-heavy apps, considering Cloud Bigtable, trading off transactions and secondary indexes.