Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 2 KB

no-sql-database.md

File metadata and controls

55 lines (42 loc) · 2 KB

NoSQL: Datastore, Cloud Firestore and Bigtable

NoSQL databases do not use the relational model and do ont require a fixed structure or schema. GCP has three NoSQL options:

  • Cloud Datastore,
  • Cloud Firestore,
  • Cloud Bigtable.

Datastore

Datastore is managed database, datastore automatically partitions data and scales up or down as demand. Datastore is used for nananalytical, nonrelational storage needs. Datastore supports indexes and transactions. Datastore does not require a fixed schema or structure and does not support relational operation like JOINS.

Record in Datastore is called Entity which is set of key-value pairs.

{
book: "ACE",
chapter: 11,
length: 20,
topic: "storage"
}
{
book: "ACE",
chapter: 11,
length: 20,
number_of_figures: 8
}

Namespace is like schema in relational database
Kind is analogous to a table in relational database
Each entity requires a key which can be an autogenerated numeric key or a custom-defined key.

After creating entites you can query the document database using GQL.

index.yaml

Index.yaml files contain indexes for complex queries that reference more than one attribute. Datastore automatically creates indexes for single attributes. All queries must have a supporting index.

Cloud Firestore

Cloud Firestore is managed NoSQL database which uses the document model (key-value pairs). Cloud Fistestore has two modes:

  • Native mode
    • Used with mobile applications
    • Supports large number of connections
  • Datastore mode:
    • Backend for server applications

Cloud Firestore is a mobile database service that can synchronize data between mobile devices and centralized storage.

Cloud Bigtable

Bigtable is NoSQL database which is wide-column database (stores a large number of columns). Bigtable is designed for petabyte-scale database with low-milisecond latency. Bigtable runs in clusters and scales horizontally, it is not serverless solution. Bigtable is used for IoT and financial data.