Bigtable in Google Cloud

Bigtable in Google Cloud

A friendly, complete guide to the database built for enormous amounts of data and very fast reads and writes. Learn how it stores information, how to design it well, and how to avoid the classic mistakes.

Imagine a giant library with billions of index cards. Each card is filed by a short label, and the cards are always kept in strict alphabetical order. If you know the label, a helper can walk straight to the right drawer and bring the card in a blink. If you want every card whose label begins with the same few letters, the helper simply picks up that whole neat stack. The library never gets too big, because when the shelves fill up, new rooms are added and the cards are shared out among more helpers. This is the core idea behind Bigtable.

Bigtable is a fully managed database service from Google Cloud. It is designed for huge amounts of data, often many terabytes or petabytes, and for very fast reading and writing, often millions of operations every second. It is a different kind of database from the tables-and-joins style you may know. In this guide you will learn what it is, how its data model works, how it runs inside, how to design it, how to keep it safe, and where it fits in real projects.

i
Good to know

Features, limits, and prices change from time to time, and Bigtable has gained new abilities over the years, including newer query options. This guide explains the ideas that stay stable. Before you size or price a real system, confirm the current numbers in the official Google Cloud documentation.

1What Is Bigtable?

Start with the big picture before we meet the details.

The simple definition

Bigtable is a NoSQL wide-column database. “NoSQL” means it does not follow the classic relational design with joined tables. “Wide-column” means each row can hold a very large and flexible set of columns, and different rows can have completely different columns. Bigtable is also fully managed, so Google handles the machines, software updates, storage, repairs, and scaling plumbing.

You can think of a Bigtable table as a huge, sorted map. You give it a row key, and it gives you back the data for that row, very quickly, no matter how many billions of rows exist.

Analogy

A normal database table is like a school register with the same columns for every student. A Bigtable table is like a giant set of labelled drawers. Each drawer can hold whatever folders it needs. One drawer may have three folders and another may have three hundred, and nobody minds.

Why it exists

Google needed a storage system for products such as web search indexing, maps, and email, where data is enormous and must be served in milliseconds. Its engineers described the design in a well-known research paper in the mid-2000s. That design inspired many other databases, such as HBase and Cassandra. Google later offered the same system to everyone as Cloud Bigtable.

Where it is used

Teams choose it for time series data such as sensor readings, for user profiles and personalisation, for financial market data, for advertising and analytics, for recommendation and machine learning features, and for any workload that writes data constantly at a very large scale.

Petabytes
scale of data it can hold
Milliseconds
typical response for key lookups
Managed
no servers or disks for you to run

2The Data Model

Six words describe how every piece of Bigtable data is organised. Learn these first.

Idea 1

Table

A container of rows. A table is stored in sorted order of its row keys.

Idea 2

Row

One entry, found by its unique row key. Changes to a single row happen all at once or not at all.

Idea 3

Column family

A named group of related columns. You create families up front, and each family has its own settings.

Idea 4

Column qualifier

The name of one column inside a family. You can add new qualifiers at any time without planning.

Idea 5

Cell

The value stored where a row and a column meet. Each cell can hold several versions of a value.

Idea 6

Timestamp

A time label on each cell version, which lets Bigtable keep history and remove old values automatically.

flowchart TD
  A["Table"] --> B["Row with key user123"]
  B --> C["Column family profile"]
  B --> D["Column family activity"]
  C --> E["Qualifier name"]
  C --> F["Qualifier city"]
  D --> G["Qualifier last_login"]
  G --> H["Cell version at time 1"]
  G --> I["Cell version at time 2"]
    
Figure 1. A row holds column families, families hold columns, and columns hold timestamped cells.

An example row

Row keyprofile:nameprofile:cityactivity:last_login
user123AshaPuneMonday 9 a.m.
user124Ravi(empty)Friday 6 p.m.
user125(empty)(empty)(empty)

Notice that empty cells are not stored at all. This is why the table is called sparse. A table with ten thousand possible columns costs almost nothing for rows that use only three. Bigtable stores only what exists.

Sorted by row key

All rows are kept in alphabetical order of their row keys, byte by byte. This is the single most important fact about Bigtable. It means that rows with similar keys sit next to each other, and a request for “all rows starting with this prefix” is very fast. Row key design is therefore the heart of good Bigtable work, which we study in Chapter 7.

Analogy

A phone directory is sorted by surname. Finding “Sharma” is quick, and finding every “Sh” is quick too. But finding every person who lives in Pune is painfully slow, because the book is not sorted by city. Bigtable is the same: it is fast for what the key is sorted by, and slow for everything else.

3Architecture and Components

Here are the building blocks that sit between your application and the stored data.

flowchart LR
  A["Application"] --> B["Bigtable Client Library"]
  B --> C["Front End Servers"]
  C --> D["Node 1"]
  C --> E["Node 2"]
  C --> F["Node 3"]
  D --> G["Colossus Distributed Storage"]
  E --> G
  F --> G
  H["Cluster Manager"] -.-> D
  H -.-> E
  H -.-> F
    
Figure 2. Nodes do the work, while the data itself lives in shared distributed storage.

The main parts

1

Instance

The top-level container. An instance holds one or more clusters and the tables they share.

2

Cluster

A group of nodes in one location, which means one zone. Adding more clusters in other zones or regions gives replication.

3

Node

A unit of compute. Each node handles requests for some share of the data. More nodes mean more speed.

4

Tablet

A slice of a table made of consecutive rows. Tables are cut into many tablets, and each tablet is looked after by one node at a time.

5

Colossus

Google’s distributed file system where the data is really stored, with several safe copies.

6

Storage type

Each cluster uses either SSD for speed or HDD for cheaper bulk storage. You choose when you create it.

Compute and storage are separate

This is a clever part of the design. The nodes do not own the data. The data sits in shared storage, and a node only holds the instructions that say which tablets it is responsible for. If a node fails, or the load changes, Bigtable simply gives its tablets to other nodes. No big data copying is needed, so rebalancing and recovery are fast.

Analogy

Picture a library where the books stay on the shelves and the librarians carry only a list that says “you look after shelves 40 to 60”. If one librarian goes home sick, the manager hands that list to someone else. No book ever has to move.

4How It Works Inside

Follow one write and one read to see why Bigtable is so quick.

sequenceDiagram
  participant App as Application
  participant N as Node
  participant L as Write Ahead Log
  participant M as Memory Table
  participant S as Sorted Files in Storage
  App->>N: Write a row
  N->>L: Record the change safely
  L-->>N: Log saved
  N->>M: Add change to memory
  N-->>App: Write confirmed
  Note over M,S: Later the memory table is flushed into a sorted file
  App->>N: Read a row
  N->>M: Check memory first
  N->>S: Check sorted files
  N-->>App: Return merged result
    
Figure 3. Writes are logged and kept in memory, then saved to sorted files in the background.

The write path

When you write, the node first records the change in a log so it can never be lost. Then it places the change in an in-memory structure that is already sorted. Because nothing has to be searched or rearranged on disk at that moment, writes are very fast. Once the memory area grows large enough, its contents are flushed into an immutable sorted file in storage. Immutable means the file is never edited, only replaced later.

The read path

When you read, the node looks in memory and in the sorted files, merges what it finds, and returns the newest version. Frequently used blocks are kept in a cache to make repeated reads even faster.

Compaction and deletes

Over time many small files pile up. Bigtable runs compaction in the background, which merges small files into bigger sorted ones and throws away old versions and deleted data. A delete is first written as a small marker, often called a tombstone, and the real clean-up happens later during compaction. This is why storage usage may not drop the instant you delete data.

Analogy

It is like keeping a notebook. You jot new notes quickly on the last page, which is fast. At the end of the week you copy the notes neatly into the proper folders and tear up the scraps. Deleting a note means putting a cross beside it first, and the cross-outs are cleared at the weekly tidy-up.

Strong consistency within a cluster

Inside a single cluster, a row is handled by one node at a time. So a read right after a write sees that write. Changes to one row are atomic, meaning all of the changes to that row succeed together or none do. However, Bigtable does not give you transactions that span many rows or many tables. Designs must keep related data in one row when they need all-or-nothing updates.

5Data Flow and Lifecycle

Every Bigtable project passes through the same stages. Knowing them helps you plan.

1

Understand the queries

List the exact questions your application will ask. The answers decide your row key.

2

Design keys and families

Choose the row key pattern and the column families, with garbage collection rules for each.

3

Create the instance

Pick the location, storage type, and number of nodes, or turn on autoscaling.

4

Load data

Write from applications, stream through Dataflow, or import files in bulk.

5

Serve and analyse

Applications read in real time. Analytics tools read in bulk without disturbing the live traffic.

6

Observe and tune

Watch load, hot spots, and storage, and adjust nodes or keys as the data grows.

7

Back up and retire

Keep backups, expire old data by rule, and remove clusters that are no longer needed.

Ways to get data in and out

  • Client libraries. Official libraries exist for popular languages such as Java, Go, Python, Node.js, and C++.
  • HBase-compatible API. Applications written for Apache HBase can often move over with little change.
  • Dataflow. Google’s stream and batch processing service reads from and writes to Bigtable, and has ready-made templates.
  • Dataproc and Spark. Big data jobs can scan Bigtable for analysis.
  • BigQuery. Analysts can query Bigtable data from the BigQuery warehouse without copying it first.
  • Import and export. Bulk files can be exchanged with Cloud Storage for loading or archiving.
  • Command line and emulator. A simple command line tool and a local emulator help with development and testing.

Garbage collection of old versions

Each cell can hold many versions, which could grow without limit. So every column family has a garbage collection policy. For example: keep only the newest three versions, or delete anything older than thirty days. Bigtable removes expired versions automatically during compaction, which keeps storage tidy and costs down.

6Designing the Schema

Bigtable rewards careful planning. A good design makes it fly. A poor design makes it crawl.

Think in queries, not in tables

With relational databases you often design the tables first and write the queries later. With Bigtable you do the opposite. Write down every important query first, then shape the row key so that each query becomes either a single-row lookup or a scan over a neat range of rows.

Column families

  • Keep the number small. A handful of families is typical. Dozens can hurt performance.
  • Group by access pattern. Put columns that are read together in the same family.
  • Group by lifetime. Put short-lived data and long-lived data into different families so each can have its own cleaning rule.
  • Use short names. Family and column names are stored with the data in every row, so shorter names save space at huge scale.

Denormalise

Because there are no joins, you usually store the data the way you will read it, even if the same fact appears in more than one place. This is called denormalisation. It uses more storage but gives fast reads, and storage is cheap compared to the cost of slow queries at scale.

!
Watch out

The row key cannot be changed after a row is created. If you choose a bad key, the cure is to create a new table with a better key and copy the data across. Spend time on the key design before you load data.

Size habits

Keep row keys short, since they are repeated throughout the system. Keep individual cells reasonably small, and avoid giant rows. Bigtable documents recommended limits for the size of a row key, a cell, and a whole row, and very large values belong in object storage with only a pointer stored in Bigtable.

7Row Key Design and Hot Spots

This is the most important chapter. The row key decides speed, balance, and cost.

The hot spot problem

Remember that rows are sorted by key and tablets hold neighbouring rows. If all new writes have keys that sort next to each other, they all land in the same tablet, which one node handles. That one node becomes overloaded while the others sit idle. This is called a hot spot.

Analogy

Imagine a supermarket with ten checkout counters, but a sign tells every customer to use counter number one. A long queue forms at one counter while nine staff stand idle. Adding more staff does not help, because the sign still sends everyone to the same place.

flowchart TD
  A["Choose a row key"] --> B{"Does it start with a timestamp or a rising number"}
  B -->|"Yes"| C["Hot spot risk on one node"]
  B -->|"No"| D{"Is the first part well spread such as a user id or device id"}
  D -->|"Yes"| E["Writes spread across nodes"]
  D -->|"No"| F["Add a salt or hash prefix"]
  C --> G["Move the timestamp later in the key"]
  G --> D
  F --> E
    
Figure 4. A simple decision path for a healthy row key.

Good and bad keys

Key patternVerdictWhy
Timestamp firstBadAll new data lands at the end of the table on one node
Auto-incrementing numberBadSame hot spot problem, since each new key is the biggest so far
Domain name in normal orderRiskyRelated names are close, which may create uneven load and poor grouping
Device id then timestampGoodDifferent devices spread writes, and one device’s readings sit together in time order
Hash prefix then idGood for even spreadSpreads load evenly but makes range scans across ids harder
Reversed domain such as com.example.wwwGoodGroups related sites together while spreading different organisations
User id then reverse timestampGoodThe newest events of each user come first, so “latest N” reads are fast

Useful techniques

  • Field promotion. Move a well-spread field, such as a device id, to the front of the key, and put the timestamp after it.
  • Salting. Add a small computed prefix, such as the remainder of a hash divided by the number of buckets, to spread writes. The trade-off is that a range read must query every bucket.
  • Reverse timestamps. Store a number that gets smaller as time moves forward, so the newest rows sort first.
  • Delimiters. Join the parts of a key with a clear separator so prefixes make sense.
  • Avoid sensitive data in keys. Keys appear in logs and tools, and they cannot be encrypted separately.
i
Tip

Bigtable offers a tool called Key Visualizer that draws a heat map of which key ranges are busy over time. Bright stripes mean hot spots. Look at it regularly, especially after launching a new feature.

8Replication and High Availability

What if a zone fails, or users are spread across the world?

flowchart LR
  A["App in Asia"] --> B["App Profile Asia"]
  C["App in Europe"] --> D["App Profile Europe"]
  B --> E["Cluster Mumbai"]
  D --> F["Cluster Belgium"]
  E |"Automatic replication"| F
  E --> G["Colossus Storage Mumbai"]
  F --> H["Colossus Storage Belgium"]
    
Figure 5. Two clusters in one instance keep copies of the same tables.

An instance can contain several clusters in different zones or regions. Bigtable copies changes between them automatically, in both directions. Usually the delay is small, but replication is eventually consistent, which means a change made in one cluster may take a moment to appear in the other.

App profiles and routing

An app profile tells Bigtable how a particular application should be routed. With single-cluster routing, all of that app’s requests go to one chosen cluster, which keeps reads consistent with writes and allows multi-row style patterns that rely on a single place. With multi-cluster routing, requests go to the nearest healthy cluster, and if one fails, traffic moves to another automatically.

Analogy

A bank with two branches keeps both ledgers up to date by phone. A customer who always visits the same branch sees consistent figures. A customer who may walk into either branch might, for a short moment, see a slightly older balance, but will always be served even if one branch closes.

Why use replication

  • High availability. A zone or region problem does not stop your service.
  • Lower delay for users. Place clusters close to where users live.
  • Workload isolation. Send live traffic to one cluster and heavy analytics jobs to another, so reports never slow down customers.
  • Disaster protection. A second region protects against a regional outage.

Cost and capacity note

Each cluster has its own nodes and storage, so replication multiplies cost. Also, when you rely on automatic failover, each cluster must have spare capacity to take over the other’s traffic, so you should keep average load lower than in a single cluster set-up.

9Scaling and Performance

Bigtable scales by adding nodes. Here is how to do it wisely.

Scaling out

To get more speed, add nodes. Because the data lives in shared storage, new nodes take over some tablets quickly, without a long data copy. Throughput grows roughly in line with the number of nodes, provided your row keys spread the load well. You can set the node count by hand or let autoscaling follow a target such as average processor use. Autoscaling suits traffic that rises and falls during the day.

Storage choices

StorageBest forRemember
SSDMost production workloads, low delay, many random readsHigher cost per gigabyte, the usual default
HDDVery large data used mostly for batch or sequential reads, and rarely for fast lookupsMuch slower for random reads, and it cannot be changed after the cluster is created

What affects speed

  • Row key design. The biggest factor, as Chapter 7 explained.
  • Node count. More nodes can handle more requests.
  • Access pattern. Single-row lookups and short range scans are fast. Scanning an entire huge table is slow and heavy.
  • Row and cell size. Smaller rows give more operations per second.
  • Network distance. Keep applications in the same region as the cluster.
  • Warm-up. A brand-new or freshly scaled cluster needs a little time under steady load to spread tablets and fill caches.
  • Client behaviour. Reuse connections and send batches, instead of creating new connections for every request.

Keep headroom

A commonly recommended practice is to keep average processor load well below the maximum, for example around two-thirds on a single cluster and lower when using failover between clusters. This leaves room for traffic spikes and for background work such as compaction. Always check the current guidance in the documentation.

10Advantages, Disadvantages, and Trade-offs

An honest view of what you gain and what you give up.

Advantages

  • Very high read and write speed with steady, low delay.
  • Scales to petabytes by adding nodes.
  • Fully managed: no servers, patching, or manual sharding.
  • Sparse storage means empty columns cost nothing.
  • Built-in replication and automatic failover.
  • Works with HBase tools and Google’s data and analytics services.

Disadvantages

  • No joins and no multi-row transactions.
  • Everything depends on one row key, which is hard to change later.
  • Poor fit for small data sets, because node cost is a fixed floor.
  • Ad hoc queries on non-key columns are slow or need extra design.
  • Hot spots can happen if keys are chosen carelessly.
  • Costs can be high if you keep many idle nodes.

The big trade-offs

Speed versus flexibility. You gain extreme speed for the queries you planned for, and you lose the freedom to ask any question you like. Teams often add BigQuery beside Bigtable for flexible analysis.

Consistency versus availability. A single cluster is strongly consistent for rows. Multi-cluster routing is more available but only eventually consistent.

Cost floor versus scale. Bigtable is a poor bargain for tiny data, and generally recommended for data in the range of a terabyte or more, or for very high request rates. Below that, other databases are simpler and cheaper.

Denormalised copies versus storage. Storing the same data in several shapes speeds reading but uses more space and needs your code to keep copies in step.

11Security

Databases hold valuable data, so protect them in layers.

Who may do what: IAM

Access is controlled by IAM, Google’s permission system. Roles can be given at the project, instance, or table level. Some roles can only read data, some can read and write, and some can manage the instance. Give each person and each program the smallest role that works. An application that only shows data should have read access only.

Analogy

A hotel gives guests a card for their own room, cleaners a card for the rooms they clean, and only the manager a master card. Nobody receives a master card just because it is convenient.

Protecting data

  • Encryption at rest. Always on by default. You can use your own keys through customer-managed encryption keys if your rules require it.
  • Encryption in transit. Connections are encrypted.
  • Private access. Use private connectivity so traffic stays off the public internet where possible.
  • VPC Service Controls. Build a protective boundary around your projects to reduce the risk of data leaving by mistake.
  • Service accounts. Use a separate service account for each application, with narrow roles, and avoid long-lived downloaded keys.
  • Audit logs. Record who administered the instance and, if you enable it, who read or wrote data.
  • Keep secrets out of keys. Row keys appear in logs and tools, so do not place personal data or passwords in them.
  • Separate environments. Use different projects for testing and production.
!
Common risk

Deleting a table or an instance is permanent. Restrict the roles that can do it, keep backups, and consider deletion protection settings where available.

12Backup and Recovery

Replication protects against failure. Backups protect against mistakes.

If a bug writes bad data or someone deletes the wrong rows, replication faithfully copies that damage to every cluster. Only a separate, earlier copy can save you. Bigtable offers managed backups of a table, which are stored with the cluster and kept for a time you choose. You can restore a backup into a new table, and you can often restore it into a different instance if your rules allow.

Backup

Table backups

Point-in-time copies kept for a set number of days, then deleted automatically.

Schedule

Automated backups

A timetable that takes backups regularly so no one has to remember.

Export

Files in Cloud Storage

Dataflow templates can export tables as files for long-term archives or for use in other tools.

Replica

Replication

Keeps a live copy in another zone or region for high availability, but is not a replacement for backups.

Plan with two numbers

RPO is how much recent data you can afford to lose. RTO is how long you can afford to be unavailable. Replication with failover gives a very short RTO for zone failures. Frequent backups give a small RPO against human error. Practise a restore at least once, because an untested backup is only a hope.

13Monitoring, Logging, and Metrics

You cannot fix what you cannot see. Watch the numbers that matter.

Metrics

Cloud Monitoring

Charts for processor use, request rates, latency, storage used, and replication delay, with alerts.

Heat map

Key Visualizer

Shows which parts of the key space are busy, so hot spots stand out as bright stripes.

Logs

Cloud Audit Logs

Records of administrative actions and, if enabled, of data access.

Insights

Query and usage insights

Tools that help find expensive or slow request patterns in your applications.

What to watch

  • Average processor load. Rising load means it is time to add nodes or to improve the design.
  • Hottest node load. If one node is far busier than the average, you probably have a hot spot, and adding nodes will not help.
  • Latency. Watch the slowest few percent of requests, not only the average.
  • Storage use. Make sure growth is expected and old versions are being cleaned.
  • Error rates and throttling. A rising count means overload or client problems.
  • Replication delay. Important when you route traffic across clusters.
  • Backup success. Verify that scheduled backups finish.

The pair of “average load” and “hottest node load” is especially helpful. When the average is low but one node is overloaded, you have a design problem. When all nodes are busy, you have a capacity problem. The cures are different, so reading the right chart saves both money and time.

14Design Patterns and Anti-patterns

Helpful habits and harmful habits seen again and again in real projects.

Helpful patterns

Time series by entity

Use the entity id first and time second. Each device or user keeps its readings together in order, while different entities spread across nodes.

Time buckets

For very busy entities, add a coarse time bucket such as the day to the key, so one entity never becomes one giant, hot row range.

Wide row for related facts

Store facts that must change together in a single row, so you get atomic updates without needing cross-row transactions.

Separate tables for separate queries

If two important queries need different key orders, keep two tables with different keys and write the data to both.

Workload isolation with app profiles

Send serving traffic and batch analytics to different clusters through different app profiles, so reports never slow down customers.

Anti-patterns to avoid

ANTI-PATTERN 01Avoid
What it looks like

A team uses the current time as the first part of every row key, so that “the newest data is easy to find”.

Why it hurts

Every new write lands at the end of the table on a single node. Adding nodes does not help, and the system becomes slow just when traffic grows.

Better approach

Start the key with a well-spread field such as a device id, and put the time after it, using a reverse timestamp if the newest rows must come first.

ANTI-PATTERN 02Avoid
What it looks like

A small application with a few gigabytes of data and complicated reporting needs picks Bigtable because it sounds powerful.

Why it hurts

The cost of nodes is wasted, and every new report needs a custom key design or a slow full scan.

Better approach

Choose a relational database such as Cloud SQL or Spanner for relational and reporting needs, and keep Bigtable for huge, key-driven workloads.

More things to steer clear of

  • Full table scans in live traffic. They load every node and slow all users.
  • Hundreds of column families. They hurt performance and are hard to manage.
  • Huge values in cells. Put large files in Cloud Storage and store only a link.
  • Running near full capacity. No room for spikes or compaction.
  • Relying on replication as a backup. It copies mistakes too.
  • Many tiny writes with new connections each time. Reuse connections and batch your requests.

15Best Practices and Common Mistakes

A checklist of habits that experienced teams rely on.

Habits that work

  • Write down the queries first. Key design follows from them.
  • Test with realistic data. Use true volume, true key patterns, and true request rates before launch.
  • Look at Key Visualizer after every major change.
  • Set garbage collection policies on purpose. Never leave unlimited versions by accident.
  • Use autoscaling for changing traffic, with sensible minimum and maximum limits.
  • Keep clients in the same region as the cluster, and reuse connections.
  • Use app profiles to separate serving and analytics.
  • Schedule backups and practise restores.
  • Use least-privilege IAM and separate production from testing.
  • Plan capacity headroom so failover and spikes do not cause an outage.
  • Label resources for cost tracking and ownership.

Mistakes beginners often make

MistakeWhat goes wrongFix
Sequential row keysOne node does all the workPromote a spread field or add a hash prefix
Treating it like a relational databaseAwkward queries and poor performanceDesign around row key lookups and ranges
Choosing HDD for live lookupsSlow random readsUse SSD for serving workloads
Too few nodes for the loadHigh latency and throttled requestsAdd nodes or enable autoscaling
No version cleaning rulesStorage and cost grow without limitSet garbage collection policies
Testing with tiny dataSurprises in productionLoad test with production-like volume
Analytics on the serving clusterCustomers feel slowdowns during reportsAdd a cluster and route analytics there
Skipping backups because of replicationMistakes spread to every replicaUse scheduled backups
Design the key for your queries, spread the load, keep headroom, and always keep a backup.

16Real-World Usage Examples

Common ways teams use Bigtable. These are typical scenarios, not claims about any particular company.

Internet of Things sensor data

A utility company collects readings from millions of meters every few minutes. Each row key begins with the meter id, followed by time. Writes spread across nodes, and a dashboard reads the last day for one meter with one fast range scan.

Personalisation and user profiles

A streaming service stores each viewer’s recent activity and preferences under the viewer id. When a page loads, the application reads one row in a few milliseconds and picks suitable recommendations.

Financial market data

A trading firm records price ticks for thousands of instruments. The key joins the instrument and the time, allowing quick replay of any instrument over any time range for analysis.

Advertising and click tracking

An advertising platform logs billions of impressions and clicks. Bigtable absorbs the constant write stream, while batch jobs aggregate it into reports.

Machine learning feature store

A bank keeps pre-computed features for each customer, such as recent spending patterns. A fraud model fetches the features in milliseconds while deciding on a payment.

Application and security logs

A platform team keeps recent logs and event histories keyed by service and time, with old versions deleted automatically after a retention period.

Migration from HBase

A company running its own Hadoop and HBase cluster moves to Bigtable. Because the interfaces are compatible, most applications continue working, and the team stops managing servers.

17Choosing the Right Database

Google Cloud has many databases. Here is how Bigtable compares.

ServiceStyleBest for
BigtableWide-column NoSQLHuge scale, very high throughput, key-based access, time series
SpannerRelational, globally distributedLarge relational data needing strong transactions and SQL
Cloud SQL and AlloyDBRelationalTraditional applications of small to medium size
FirestoreDocument databaseMobile and web apps with flexible documents and real-time sync
BigQueryAnalytics warehouseLarge-scale analysis and reporting with SQL
MemorystoreIn-memory cacheCaching and extremely fast temporary data

A simple rule of thumb: if you have enormous data or request rates and you know your access pattern by key, choose Bigtable. If you need joins and transactions, choose a relational option. If you need flexible analysis of everything, choose BigQuery. If you have small data, choose something simpler. Many large systems combine them, using Bigtable to serve and BigQuery to analyse.

18Frequently Asked Questions

Q1Is Bigtable a relational database?
No. It is a NoSQL wide-column store with no joins and no multi-row transactions. It is designed for speed and scale on key-based access.
Q2Can I use SQL with it?
Bigtable has traditionally been used through its own client libraries and the HBase API. Newer releases have added SQL-style querying options, and you can also query it from BigQuery. Check the current documentation for what is available and its limits.
Q3Can I change the row key later?
Not in place. To change the key design, create a new table with the new key and copy the data across, so choose carefully at the start.
Q4How big does my data have to be?
Bigtable shines at large scale, often a terabyte or more, or at very high request rates. For small data sets, other databases are usually cheaper and simpler.
Q5How do I make it faster?
First check row key design and hot spots. If load is spread evenly and processor use is high, add nodes or turn on autoscaling. Also keep clients near the cluster and reuse connections.
Q6Is data consistent across clusters?
Within one cluster, yes, strongly for each row. Between clusters replication is eventually consistent. Use single-cluster routing when an application needs to read its own writes reliably.
Q7What happens when a node fails?
The tablets handled by that node are assigned to other nodes automatically. Because the data sits in shared storage, nothing needs to be copied, and recovery is quick.
Q8Do I pay when no one uses it?
Yes, because nodes and storage are billed while they exist, even when idle. Autoscaling and right-sizing help control cost. Check the pricing page for the current rates.
Q9Is my data encrypted?
Yes. Data is encrypted at rest and in transit by default, and you can use your own encryption keys if required.
Q10Can I run big analytics without slowing my live app?
Yes. Add a second cluster and use an app profile to send analytics traffic to it, or export data to an analytics system such as BigQuery.

19Summary and Key Takeaways

What to remember

  • Bigtable is a managed wide-column NoSQL database built for enormous data and very fast reads and writes, organised as a huge sorted map of rows.
  • The row key is everything. Rows are sorted by key, so design the key around your queries and avoid keys that start with timestamps or rising numbers.
  • Compute and storage are separate. Nodes hold tablet assignments while data lives in shared storage, so scaling and recovery are fast.
  • Watch for hot spots. Use Key Visualizer and compare average load with hottest-node load to tell a design problem from a capacity problem.
  • Replication is for availability, backups are for mistakes. Use app profiles to route traffic and to isolate analytics, and schedule backups you have tested.
  • Know its limits. No joins, no multi-row transactions, and a poor fit for small data. Pair it with BigQuery or a relational database when needed.
  • Secure and manage with care. Use least-privilege IAM, encryption keys where required, garbage collection rules, headroom for spikes, and alerts on the metrics that matter.