If you store customer orders or sensor data in a traditional database designed for spreadsheets, your application will slow to a crawl when thousands of requests come in every second. For the Google Professional Data Engineer exam, you must know how to choose between Cloud Bigtable and Firestore — two radically different databases that handle massive, fast-moving data without breaking a sweat.
Jump to a section
A simple way to picture Storing NoSQL Data with Cloud Bigtable and Firestore
Your friend is throwing a massive party and asks you to manage the drinks. You have 27 people arriving in the first hour, each wanting a different brand of beer, soda, or water. A regular fridge would work, but the door would be opening and closing every 15 seconds, the shelves would be chaotic, and the temperature would rise. Instead, you buy a giant, industrial cooler shaped like a chest. You don't organise drinks by brand alphabetically. You put all the beers in one row, sodas in the next, and waters in the back. When a guest shouts 'I need a cola', you don't scan every label — you walk straight to the soda row, grab the first cola from the front bin, and hand it over in under two seconds. That chest cooler is Cloud Bigtable. It is designed for that exact scenario: very wide (many columns for attributes like brand, type, temperature preference) and very shallow (just one row key per guest). It has no complicated relationships between drinks. If someone asks for 'a random beer and a soda to mix', the cooler fails — that would require a relational database like Cloud SQL. But for the party of 27 guests demanding high-speed, high-volume access to simple items by a single key (their drink order ID), the chest cooler is perfect. The regular fridge, with its organised shelves, is Firestore — still fast, but better for smaller parties where you need to search for 'all drinks that are low-calorie' or 'drinks that need to stay under 5 degrees'.
Before we talk about Cloud Bigtable and Firestore, you need to understand what a NoSQL database is. The term 'NoSQL' stands for 'Not Only SQL'. Traditional databases, called relational databases (like Cloud SQL or MySQL), store data in tables with strict rows and columns. Every row must have the same columns, and you must define the columns ahead of time. This is great for things like a bank account system where every account has an account number, balance, and owner name. But it is terrible for storing data that changes shape over time, like a social media post where one post has text, another has an image, and a third has a video.
NoSQL databases throw away the strict table structure. They allow each piece of data (called a 'record' or 'document') to have different fields. This makes them incredibly flexible and fast for certain workloads. Google Cloud offers two main NoSQL databases: Cloud Bigtable and Firestore. They solve different problems.
Cloud Bigtable is a 'wide-column' NoSQL database. Imagine a giant spreadsheet where each row has many, many columns (sometimes thousands), but each row does not need to have all the columns. The most important thing in Bigtable is the 'row key'. This is a unique identifier for each row, like a customer ID. Bigtable can only look up data by this row key. It cannot do complex searches like 'find all customers who are male and over 30 years old'. It can only say 'give me the row for customer ID 529'. If you want to scan many rows, you can ask for all rows where the row key starts with '529', but that is a limited scan. Bigtable is built for very high throughput (thousands of reads and writes per second) and very low latency (under 10 milliseconds). It stores data on Solid State Drives (SSDs) or Hard Disk Drives (HDDs). It is excellent for time-series data (like sensor readings every second), financial trading data, and recommendation engine data. It was inspired by Google's internal Bigtable system, which powers Google Search and Gmail.
Firestore is a 'document-oriented' NoSQL database. Imagine a collection of file folders. Each folder is a 'document', and documents are stored in 'collections'. A document can contain any fields you want: text, numbers, lists, or even sub-documents. For example, a document for a user might have fields like 'name', 'email', 'favourite_colours' (a list), and 'address' (a sub-document with 'street' and 'city'). Firestore can do complex queries. You can say 'find all users where age is greater than 25 and favourite_colour includes blue'. Firestore maintains indexes (like a book index) to make these searches fast. It is designed for mobile and web applications that need real-time updates. If a user updates a document, every other user watching that document gets the change within seconds. Firestore also has strong consistency guarantees — when a write completes, every subsequent read will see the new data. Bigtable, by contrast, has 'eventual consistency' for some operations, meaning a read immediately after a write might not see the latest data.
What do these databases replace? They replace the need for a relational database with complex joins (combining data from different tables) when your data does not have many relationships. They also replace the need for manual scaling. With a traditional database, if you suddenly get 100 times more users, you have to buy a bigger server or reconfigure your system. Bigtable and Firestore are 'managed services' on Google Cloud — Google handles the scaling for you. Bigtable can grow from 1 node to hundreds of nodes automatically. Firestore scales automatically based on traffic.
Why do they exist? Because modern applications generate data at a speed and volume that traditional relational databases cannot handle. A single IoT (Internet of Things) device might send a temperature reading every second. If you have 10 million devices, that is 10 million writes per second. A relational database would collapse. Bigtable handles this effortlessly. Similarly, a chat app where every message triggers a notification to dozens of users needs real-time speed and flexible data structures — Firestore handles that.
When deciding which to use, think about the query patterns. If you only ever need to look up data by a single key (like a device ID or user ID) and you need millions of writes per second, choose Cloud Bigtable. If you need to do complex searches ('find all orders in the last hour that cost over $50') and you want real-time updates, choose Firestore. For the PDE exam, you must memorise that Bigtable is for analytical, high-throughput workloads (think 'data science and analytics') and Firestore is for transactional, user-facing applications (think 'mobile apps and websites').
Identify the data access pattern
Determine whether your application will primarily look up data by a single unique identifier (e.g., device ID, order ID) or will need complex queries with multiple filters and sorting. If it is the former, consider Cloud Bigtable. If it is the latter, consider Firestore. This step saves you from using the wrong database.
Design the schema (no strict schema required)
For Bigtable, decide on a row key. A common pattern is to concatenate an entity ID with a timestamp, e.g., 'device123#20241005'. For Firestore, create collections and decide on document IDs and fields. Remember that in Firestore you can have subcollections for nesting related data. There is no need to define columns in advance.
Choose the database mode and location
For Bigtable, you pick an instance ID, choose between development (low performance, cheap) or production (high performance) instance, and set the storage type (SSD or HDD). For Firestore, you choose between Native mode (recommended for new apps) and Datastore mode. You also select the database region (e.g., us-central1) or enable multi-region replication.
Write data using client libraries
Use the Google Cloud client library for your programming language. For Bigtable, you create a connection object, then a table object, and use the 'put' method to insert rows. For Firestore, you use the 'set' method on a document reference. Example: In Python for Firestore: db.collection('users').document('user1').set({'name': 'Alice', 'age': 30}).
Read data using appropriate methods
For Bigtable, you read a specific row by its key using the 'get' method. To scan multiple rows, you use a 'scan' with a start and end key. For Firestore, you use the 'get' method to retrieve a specific document, or use 'where' clauses to query collections. Example: db.collection('users').where('age', '>', 25).get().
Monitor and scale the database
Use Cloud Monitoring to watch latency, throughput, and error rates. For Bigtable, you can manually add nodes or enable autoscaling to handle traffic spikes. For Firestore, scaling is automatic, but you must monitor the write throughput limit and request a quota increase if needed. Set up alerts for high latency or error rates.
Imagine you are building the backend for a mobile game called 'Galaxy Racers'. Players compete in real-time races across the galaxy. Each player has a profile, a list of owned spaceships, and a race history. You have 5 million active players. You need to store every race result so that later you can analyse which spaceships are most popular. You also need to show a player their friend list and update it in real time when a friend changes their profile picture.
Step 1: You identify that the player profile and friend list need complex queries. A player might search for 'all friends who have played in the last week' or 'all ships that are faster than 200 mph'. This is a perfect fit for Firestore. You create a collection called 'players'. Each document in this collection has a unique player ID as the document ID. The document holds fields like 'username', 'email', 'spaceships_owned' (a list of strings), and 'friends' (a list of player IDs). Firestore handles real-time updates easily — when a player changes their username, the app updates the Firestore document, and all friends see the change instantly.
Step 2: The race results, however, are a different beast. Every race generates a record containing the race ID, the participating player IDs, the start time, the finish time, and the spaceship used. With 5 million players, there could be 500,000 races per day. You need to be able to look up the history for a single player quickly (by player ID) and you need to perform massive analytical queries later, like 'what was the average race time for spaceship X in region Y last month'. For this, you choose Cloud Bigtable. The row key for each race result is a combination of player ID and race start time, like 'player123#20241005T143022'. This allows fast lookups for a specific player's races, and you can scan all rows that start with a particular player ID.
Step 3: You configure Bigtable with a cluster of 5 nodes initially, with SSDs for low latency. You set up automatic scaling so that when a new game update drives 10x more races, Bigtable adds nodes automatically. You also enable 'replication' across two Google Cloud regions (e.g., us-east1 and europe-west1) so that players on different continents get similar latency. Bigtable automatically replicates data between the regions with eventual consistency.
Step 4: For Firestore, you enable 'Firestore in Native mode' (rather than Datastore mode). You use Firestore Security Rules to control who can read and write which documents. You also set up a 'Cloud Function' that triggers every time a new race result document is added to a 'race_results' collection in Firestore (note: for this scenario, you might actually use Bigtable for race results, so this Cloud Function might be for an auxiliary task). The Cloud Function sends a push notification to the player saying 'Your race result is saved!'.
What does an IT professional actually do? They do not build the database from scratch. They use the Google Cloud Console (a web interface) or the gcloud command-line tool to create a Bigtable instance or a Firestore database. They write code (usually in Python, Go, or Java) that uses the client libraries to read and write data. For Bigtable, they install the 'hbase-client' library and write commands like 'table.put(row_key, column_family, column_qualifier, value)'. For Firestore, they use client libraries and write commands like 'db.collection("players").document("player123").set({"username": "racer99"})'. They monitor the databases using Cloud Monitoring to check latency, throughput, and error rates. They also manage backups. For Bigtable, they configure 'backup schedules' that create copies of the table data to Cloud Storage. For Firestore, they use 'Firestore Export' to export all data to a Cloud Storage bucket periodically.
The PDE exam tests your ability to distinguish between Cloud Bigtable and Firestore in specific scenarios. Expect the following question types:
Scenario-based multiple-choice: The question describes a business case (e.g., 'A shipping company tracks 100 million package locations per day. Each update is a simple key-value pair: package ID, timestamp, latitude, longitude. Queries are always by package ID. Which database should they use?'). The correct answer is Cloud Bigtable. The trap is choosing Cloud Spanner (a relational database that can scale but is overkill) or Firestore (which has a limit on write throughput and is not optimised for such high write volumes).
Compare and contrast: 'Which of the following is a characteristic of Firestore but NOT of Cloud Bigtable?' Correct answer would be 'Supports complex queries with multiple filters and sorting'. Bigtable only supports point lookups by row key and limited scans. Another trap: 'Provides strong consistency for all reads' — Firestore has strong consistency for single-row reads, but Bigtable also has strong consistency for single-row reads. The nuance is that Bigtable has eventual consistency for multi-row scans.
Use case matching: 'Which NoSQL database is best suited for real-time mobile application data?' Firestore. 'Which NoSQL database is best suited for time-series IoT data?' Bigtable.
The exam loves to test these concepts:
Row key design in Bigtable: They will ask how to design a row key to avoid 'hotspotting' (where one node gets all the traffic). A good design uses a 'salt' (a random prefix) or a hash of the row key. Example: instead of using a timestamp as the row key (which causes all writes to hit the same node), prepend a hash of the device ID.
Firestore data modelling: They want you to know about 'collections' and 'documents', and the difference between 'subcollections' (documents nested within other documents) and 'top-level collections'. They also test 'Firestore in Native mode' vs. 'Datastore mode'. Native mode has real-time updates and strong consistency; Datastore mode is the older version with slightly different APIs.
Consistency models: Bigtable is 'eventually consistent' for cross-region replication (if you use replication across multiple regions). Firestore is 'strongly consistent' within a single region. For the exam, know that if your application requires immediate consistency across regions, you must use Firestore (or Cloud Spanner) — not Bigtable.
Throughput limits: Bigtable can handle millions of writes per second. Firestore has a maximum write rate of 10,000 writes per second per database (though you can increase the limit by requesting it). The exam may test that if a use case requires more than 10,000 writes per second, you should consider Bigtable.
Pricing models: Bigtable charges per node per hour (plus storage). Firestore charges per read, write, delete, and storage. The exam might ask which is more cost-effective for a specific workload.
When to use Cloud Spanner: A common trap is offering Cloud Spanner (a globally distributed relational database) when the data has no relations and needs high throughput — but Bigtable is the cheaper and simpler choice. The exam will throw Cloud Spanner as a distractor.
To memorise: For exam purposes, remember the mnemonic 'BATS' — Bigtable for Analytical, Time-series, Simple keys. Firestore for Transactional, User-facing, Searchable.
Cloud Bigtable is a wide-column NoSQL database optimised for high-throughput, low-latency lookups by a single row key, ideal for time-series and IoT data.
Firestore is a document-oriented NoSQL database with real-time capabilities and complex query support, best for mobile and web applications with user-facing data.
Bigtable does not support secondary indexes or complex queries; you can only query by row key or scan by row key prefix.
Firestore supports strong consistency for all reads and writes, while Bigtable offers eventual consistency for cross-region replication.
Row key design in Bigtable is critical to avoid hotspotting — use a hash or salt prefix to distribute writes evenly across nodes.
Firestore has a maximum write throughput of 10,000 writes per second per database (adjustable), whereas Bigtable can handle millions of writes per second.
For the PDE exam, if the scenario involves analytical, high-volume, key-based lookups, choose Bigtable. For real-time, transactional, query-heavy workloads, choose Firestore.
These come up on the exam all the time. Here's how to tell them apart.
Cloud Bigtable
Wide-column NoSQL database where rows store sparse, columnar data
Optimised for high throughput (millions of writes per second)
Only supports point lookups by row key and row key prefix scans
Firestore
Document-oriented NoSQL database where data is stored in documents with key-value fields
Optimised for mobile and web apps with real-time updates
Supports complex queries with multiple filters, sorting, and range filters
Cloud Bigtable
NoSQL, no joins, no schema enforcement
Eventually consistent across regions
Ideal for time-series and IoT data with simple key-based access
Cloud Spanner
Relational SQL database with full ACID transactions and joins
Strongly consistent across all regions globally
Ideal for OLTP workloads requiring global consistency and relational data
Firestore Native Mode
Supports real-time listeners (snapshots)
Strongly consistent by default
Recommended for new mobile and web applications
Firestore Datastore Mode
No real-time listeners (requires polling)
Provides eventual consistency for queries (strong for entity lookups)
Legacy mode, compatible with older App Engine applications
Mistake
Cloud Bigtable and Firestore are interchangeable — you can use either for any NoSQL workload.
Correct
They are designed for fundamentally different use cases. Bigtable is for high-throughput, sparse data with simple key-based lookups. Firestore is for mobile and web apps needing real-time updates and complex queries. Using the wrong one leads to high costs or poor performance.
Because both are called 'NoSQL', beginners assume they are similar. In reality, their data models and access patterns are as different as a filing cabinet and a library card catalogue.
Mistake
Bigtable supports complex queries like 'find all users under 30 who live in New York' with indexes.
Correct
Bigtable does not support secondary indexes. You can only query by the row key or scan rows by row key prefix. You cannot filter on column values unless you perform a full table scan, which is slow.
People hear 'Bigtable is like a spreadsheet' and think they can use SQL-like filters. They confuse it with Cloud Spanner or Firestore, which do support complex queries.
Mistake
Firestore is a relational database because it supports transactions and strong consistency.
Correct
Firestore is a NoSQL document database. It supports ACID (Atomic, Consistent, Isolated, Durable) transactions, but it does not enforce a schema, and data is stored in documents, not related tables. There are no joins — relationships are modelled by embedding data or using references.
Because Firestore has 'transactions' and 'strong consistency' — features typically associated with relational databases — beginners assume it is relational. They miss that it lacks SQL querying and join capabilities.
Mistake
Bigtable is ideal for storing user profiles with many fields, like a social media app.
Correct
Bigtable is poor for user profiles because you often need to query by multiple attributes (e.g., 'find users in a certain city'). Bigtable cannot do that without scanning all rows. Firestore is far better for user profiles.
Since Bigtable can handle 'wide' rows with many columns, beginners think it can store any kind of structured data. They forget that query flexibility matters.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Technically yes, but it is not recommended. Chat applications need complex queries like 'find all messages sent to a particular user' and real-time updates. Bigtable cannot do complex queries and does not have built-in real-time listeners. Firestore is built exactly for this use case, with real-time snapshot listeners and query flexibility.
No, Firestore does not support SQL. It uses its own query language that is similar to MongoDB's queries. You use methods like .where(), .orderBy(), and .limit(). You cannot use JOINs, GROUP BY, or other SQL constructs. For SQL, use Cloud SQL or Cloud Spanner.
A row key is a unique string that identifies a row in a Bigtable table, similar to a primary key in a relational database. It is important because Bigtable stores rows sorted by row key, and all queries are based on the row key. A poorly designed row key can cause 'hotspotting', where one node handles all traffic, slowing down the entire system.
Bigtable is strongly consistent for single-row reads and writes within a single cluster. However, if you use multi-region replication, it provides eventual consistency across regions — meaning a write in one region may not be immediately visible in another region. Firestore provides strong consistency across all reads and writes within a single region.
It is not ideal. Firestore has a write limit of about 10,000 writes per second per database (adjustable). If you have thousands of stocks and you write every second, you will quickly hit that limit. Bigtable is designed for millions of writes per second and is the correct choice for high-frequency time-series data.
Firestore does not support joins. To combine data, you must either embed related data in a single document (denormalisation) or perform two separate queries in your application code and join the results yourself. This is a trade-off for the flexibility and speed of NoSQL.
You've finished Storing NoSQL Data with Cloud Bigtable and Firestore. Continue through the PDE study guide to build a complete picture of the exam.
Done with this chapter?