Data Engineering · Module 11
Data warehouses
- Lessons
- 11
- Free
- 1
- Reading
- ~3 h
Your progress
0 / 11 lessons done
Sign in to trackLessons
- Data warehouses: built for analytical queriesFreeEvery growing company reaches the day when someone runs a report on the app’s database and slows the app down. Knowing what a warehouse does differently tells you when you need one, and when you don’t yet.
- How cloud warehouses separate storage and computeMost slow-report complaints in a cloud warehouse are not about the data at all: two workloads are sharing one pool of compute. Knowing where the data lives and where the work happens tells you whether to resize, split or wait.
- Columnar execution and massively parallel processingEvery warehouse bill and every slow dashboard comes back to three questions: how many bytes a query reads, how fast each core works through them, and how evenly the work splits. Knowing the mechanism lets you read a query profile and fix the right one.
- Partitioning, clustering and pruningA date filter makes a warehouse query cheap only when rows with nearby dates sit together. When they don’t, every dashboard tile reads the whole table, and the bill and the wait grow with the table, not with the question.
- Materialized views and aggregate tablesMost slow, expensive dashboards repeat one large GROUP BY every time someone opens them. Storing that answer once is usually the biggest single saving in a warehouse, and choosing how it stays fresh decides whether the numbers can be trusted.
- Loading data into a warehouseAlmost every table in a warehouse starts as a file in object storage or a row in a stream. Picking the loader decides how fresh the data is, what it costs, and whether a retry quietly doubles a day.
- Warehouse costs: what you actually pay forA warehouse bill is mostly compute time, and much of that time can be a warehouse waiting for its next query. Knowing what each meter counts is how you explain a bill, and how you stop the next one growing.
- Snowflake, BigQuery, Redshift and others comparedEvery data team is asked at some point why it uses its warehouse and not another one. A good answer names the workload, the data’s location and the cost of moving, not a winner.
- Warehouse access control and data sharingA warehouse holds every table the business has, including customers’ phone numbers. Who can read what, and how data leaves the account, decide whether a leak or a stale partner report happens on an ordinary Friday.
- Tuning slow warehouse queriesEvery warehouse team gets the message “this query is slow, can we make the warehouse bigger?”. Reading the query profile first usually finds the waste, and the fix costs nothing a month instead of four times the credits.
- Design: a reporting warehouse for an online storeMost companies end up with one warehouse account that finance, dashboards, analysts and partners all depend on. Each part can be set up correctly and one team’s bad night can still reach everyone, so the account has to be designed as a whole, around who reads it and what each failure would cost them.
Practise with
No tools or paper guides for this module yet.
Terms this module teaches 38
Open glossaryAggregate table
An ordinary table holding pre-computed sums and counts at a coarser grain than the fact table, rebuilt by a pipeline.
Auto-suspend
A warehouse setting that stops its compute after a set time without queries, ending its compute bill and dropping its cache until a new query resumes it.
Automatic Clustering
Snowflake’s background service that rewrites micro-partitions to keep a table ordered by its clustering key, billed separately from virtual warehouses.
Automatic query rewrite
The optimizer answering a query on a base table from a materialized view, without the query naming the view.
BigQuery
Google Cloud’s serverless data warehouse, where tables can be partitioned by a column and clustered by up to four columns.
BigQuery slot
A unit of virtual compute that BigQuery uses to run a query; teams either pay per data scanned or reserve a number of slots over time.
Cloud services layer
In Snowflake, the shared layer that handles sign-in, access control, metadata and query planning for every warehouse in an account.
Clustering depth
For a column, the average number of micro-partitions whose value ranges overlap; the lower it is, the more a filter on that column can skip.
Clustering key
Columns or expressions a warehouse table is kept ordered by, so filters on them can skip most blocks.
Databricks Unit (DBU)
Databricks’ unit for billing compute; each SQL warehouse size uses a set number of DBUs an hour, and the price per DBU depends on the product and plan.
Exploding join
A join that returns many more rows than it reads, because its key matches several rows on both sides or it has no join condition.
Fail-safe
In Snowflake, a further 7 days that a permanent table’s old data is kept after Time Travel ends, recoverable only by Snowflake and billed as storage.
Future grant
A grant that sets the privileges every new object of a type in a schema or database starts with.
Masking policy
A rule attached to a column that rewrites its value at query time depending on who is asking; the stored data doesn’t change.
Massively parallel processing (MPP)
Running one query by cutting it into pieces that many machines work on at the same time, each over its own part of the data.
Metabase
An open-source dashboard and reporting tool that turns questions and charts into SQL queries against a database or warehouse.
Micro-partition (Snowflake)
The unit Snowflake stores a table in: a compressed, columnar block with min and max values per column that queries use to skip it.
Multi-cluster warehouse (Snowflake)
A Snowflake virtual warehouse that can run several clusters of the same size at once, so more queries run together without each getting faster.
Natural clustering
The order a table gets from the order rows were loaded in, without any key: rows that arrive together are stored together.
Offset token
A position the writer stores with each batch of rows in a Snowpipe Streaming channel, so after a restart it can continue from the last committed row without duplicates.
Query Profile (Snowflake)
Snowflake’s view of one query’s plan as a tree of operators, with the time each took and statistics such as partitions scanned and bytes spilled.
Reader account
A Snowflake account a data provider creates and pays for, so a consumer without its own account can query shared data.
Redshift Processing Unit (RPU)
The unit of compute in Amazon Redshift Serverless; a workgroup runs with a number of RPUs and is billed in RPU-hours.
Resource monitor
A Snowflake object that counts the credits one or more warehouses use in each interval and notifies or suspends them at chosen thresholds.
Result cache
Stored results of past queries that a warehouse can return again without running the query, as long as the query text matches exactly and the data hasn’t changed.
Role hierarchy
A tree of roles where a role granted to another role passes on all its privileges, so the higher role can do everything the lower one can.
Row access policy
A rule attached to a table that returns true or false for each row, so every query on the table returns only the rows the rule allows for the person asking.
Secure data sharing
Giving another warehouse account read-only access to your tables or secure views in place, without copying the data.
Secure view
A view whose definition is hidden from readers who don’t own it; the only kind of view a Snowflake share can contain.
Separation of storage and compute
A warehouse design where table data lives once in shared storage and queries run on compute clusters that can be added, sized and stopped without moving the data.
Snowflake credit
The unit Snowflake bills compute in: a warehouse uses a fixed number of credits per hour while it runs, set by its size, and each credit has a price that depends on the edition and region.
Snowpipe
Snowflake’s service that runs a COPY for each new file in a stage, on compute Snowflake manages, usually started by a cloud storage event.
Snowpipe Streaming
Snowflake’s way to write rows straight into a table through an SDK or API, with no staged files, so rows can be queried within seconds.
Target lag
The most a Snowflake dynamic table may fall behind its base tables; Snowflake schedules refreshes to stay within it.
Tuple-at-a-time execution
Running a query plan by passing one row at a time between operators, each operator asking the one below it for its next row.
Warehouse cache
Table data a running virtual warehouse keeps after reading it, so later queries on that warehouse skip fetching it from storage; it is dropped when the warehouse suspends.
Warehouse idle time
Time a warehouse is running and billing with no query on it; its credits are metered credits minus attributed credits.
Warehouse queuing
A query waiting before it runs because its warehouse is busy with other queries or is still starting; recorded separately from execution time.