Skip to main content

BigQuery

Exam guide§2.2
BigQuery

Serverless analytics data warehouse. SQL over petabytes, separates storage from compute, pay per query (or slots). Scales to zero when idle. Pick it for enterprise data warehousing, analytics, dashboards, and BI. Not for transactional single-row workloads.

Access

No database administrator needed - you query with familiar SQL and let Google's infrastructure do the work. Reach BigQuery through:

  • The Google Cloud console
  • The bq command-line tool
  • The BigQuery REST API via client libraries (Java, .NET, Python)
  • Third-party tools for visualizing or loading data

Query example

Standard SQL over a table groceries, aliased as g. SELECT g.* returns one output column per column in the table:

WITH groceries AS
(SELECT "milk" AS dairy,
"eggs" AS protein,
"bread" AS grain)
SELECT g.*
FROM groceries AS g;
+-------+---------+-------+
| dairy | protein | grain |
+-------+---------+-------+
| milk | eggs | bread |
+-------+---------+-------+

Loading data

Stage files in Cloud Storage first, then batch-load with bq load - the standard ingest pattern. For streaming rows, use the BigQuery Storage Write API instead.

Commandsbq load from GCS
bq load --source_format=CSV mydataset.mytable gs://my-bucket/data.csv schema.json
bq load --source_format=NEWLINE_DELIMITED_JSON mydataset.mytable gs://my-bucket/data.json
0%0 of 147 pages studied