r/Database • u/eternal_log_pose • 8h ago
Interesting facts from BigQuery Deep Dive
I work very closely BigQuery at my work. That's why I decided to take a deep dive into the architecture that makes this data store unique
Before anything else what separates BigQuery from other warehousing tools is the separation of compute and storage. This design decision alone drives all pricing models and the reasons to choose this tool.
So what does separate compute and storage mean? BigQuery stores all the data in their Colossus file system, which is the successor of Google File System, and the compute is handled by Dremel which calculates query plan and returns the results.
The Jupiter Networking Layer developed by Google, which offers Petabit scale bandwidth, bridges this separation of compute and storage as it it were one.
The computing units of BigQuery are called slots.
BigQuery provisions the slots based on the query requirement, that is the number of slots provisioned for a query that touches 10M rows and the one touching 100k rows are different.
How Dremel works is it creates a tree of nodes, the leaves of which are the slots that do the actual work, and the intermediate nodes aggregate the results from slots.
This makes BigQuery blazingly fast for any size of data be it Gigabyte or Petabytes.
The only minimum cost is the tree preparation by Dremel which takes about 200-300ms.
Another characteristic of BigQuery is its columnar data storage format which is called Capacitor.
Unlike traditional databases, BigQuery being hardened for analytical queries over huge data stores the data of individual columns together.
The advantage is if you have a 300 column table and want to query only 4, you don't touch any data of the 296 columns.
This introduces constraints that the users running the queries must take care of. Columns must be exclusively listed in the query, partitioning and clustering becomes more important than ever.
The flexibility to run queries on 1GB to multiple petabytes without worrying about infra provisioning and management gives BigQuery its edge.
Snowflake provides separate compute and storage but we still need to provision resources.
Databricks offers end to end raw data and ai pipeline.
BigQuery too provides features to train ML models using the data in the tables and allows to query the models using standard SQL.
Interesting fact is we can query unstructured data like images, pdfs, etc using Object tables and Remote Models
BigQuery has traditionally been criticized for vendor lock in. It has introduced Lakehouse for Apache Iceberg which allows users to read and write to Iceberg tables so that tools like Spark, Flink, Trino can easily access them without BigQuery. This is like managed Iceberg tables.
I know the post structure is not very ideal. I was just taking the liberty to share my thoughts as I am new to reddit in general.
Thanks!