Analytical / warehouse
The analytical tier, in two halves: the concepts child holds everything true of every warehouse and columnar engine — columnar storage and pruning, vectorized and MPP execution, storage and compute kept apart, workload isolation and the analytical query shapes — and the four product subtrees beside it (Snowflake, BigQuery, Redshift, ClickHouse) hold what is true of one product only. Interviewers use this area to check I can pick the right store for a BI or reporting workload and explain why an OLTP database buckles under one.
on this pageshowhide
explore
- Analytical Database Concepts76 questions
- Columnar Storage & Encoding29 questions
- MPP & Warehouse Architecture24 questions
- OLAP Query Patterns23 questions
- Snowflake (has its own guide)36 questions
- Architecture Overview6 questions
- Virtual Warehouses5 questions
- Micro-partitions & Clustering6 questions
- Data Loading & Stages6 questions
- Data Sharing & Marketplace6 questions
- Cost & Performance Tuning7 questions
- Google BigQuery (has its own guide)36 questions
- Serverless Architecture6 questions
- SQL and Data Types6 questions
- Partitioning and Clustering6 questions
- Data Loading and Streaming6 questions
- Pricing and Slots6 questions
- ML and BI Integration6 questions
- Amazon Redshift (has its own guide)31 questions
- Cluster Architecture & RA36 questions
- Distribution & Sort Keys6 questions
- Spectrum & External Data7 questions
- WLM & Concurrency Scaling6 questions
- Loading, UNLOAD & Upserts6 questions
- ClickHouse (has its own guide)38 questions
- Storage Engines6 questions
- Partitioning & Indexing7 questions
- SQL Dialect & Functions7 questions
- Materialized Views6 questions
- Data Ingestion6 questions
- Query Performance6 questions
→ has its own guide
questions
217 · 5 sectionsIn a cloud data warehouse, what does separating storage from compute actually mean?
basics
~20 sTable data lives as files in a shared object store that every node can read over the network, and compute clusters are stateless workers that read it. Either side can be resized, paused or duplicated without touching the other.
What is the difference between a data warehouse and a data lake for analytical data?
basics
~20 sA data warehouse stores data in an engine-managed, usually proprietary format with an enforced schema and integrated compute. A data lake stores raw files in object storage that many engines can read, with structure applied only at query time.
How does APPROX_COUNT_DISTINCT differ from COUNT(DISTINCT) in an analytical engine?
basics
~20 sAPPROX_COUNT_DISTINCT returns an estimated number of distinct values computed from a small fixed-size sketch, rather than the exact number computed by tracking every value seen. It uses far less memory and time, at a few percent typical error.
In a columnar table, why does selecting 3 columns of 200 read far less data than SELECT *?
basics
~20 sEach column's values sit contiguously in their own chunks, and the file metadata records where every chunk starts. The scan reads only the byte ranges of the columns the query names; the other columns are never opened or decompressed.
In a columnar table, how does a per-column encoding differ from a block codec like ZSTD?
basics
~20 sAn encoding rewrites one column's values in a type-aware way — dictionary codes, run lengths, deltas — and can often be queried directly. A codec such as ZSTD then compresses those encoded bytes opaquely, and the block must be decompressed before anything can read it.
What are the three layers of Snowflake's architecture, and what does each one own?
basics
~20 sSnowflake separates storage (compressed columnar data in cloud object storage), compute (virtual warehouses, independent clusters that run queries), and cloud services (metadata, query optimization, transactions, security). The three layers scale independently and are billed separately.
In Snowflake, what actually consumes credits, and what is billed outside the credit meter?
basics
~20 sCredits meter compute: a virtual warehouse burns them per second while it is running, serverless features burn them with no warehouse, and cloud services burn them above a daily allowance. Storage and data egress are billed separately, not in credits.
In Snowflake, what are internal and external stages, and how do files get into each?
basics
~20 sA Snowflake stage is a named location that holds data files for loading. Internal stages live in Snowflake-managed storage and receive files through the PUT command; external stages point at a bucket you own in S3, Azure Blob or GCS.
Why can a Snowflake query filter a huge table fast when Snowflake has no indexes?
basics
~20 sSnowflake splits every table into immutable micro-partitions and keeps per-column min/max metadata for each one. A filter is compared against that metadata, so only micro-partitions whose value ranges could match are read. Skipping the rest replaces indexes.
In Snowflake, what is a virtual warehouse and what changes when you resize it from X-Small to Large?
basics
~20 sA Snowflake virtual warehouse is a named cluster of compute nodes that runs queries, DML and loads; it stores no data. Each size step up doubles the compute in the cluster and doubles the credits billed per running hour.
Why doesn't BigQuery require you to provision or size a cluster before running a query?
basics
~20 sBigQuery is serverless: table data lives in Google-managed storage, and compute comes from a shared pool that Google's scheduler assigns to your query as slots for the duration of the query. There is no cluster to create, size, or resume.
In BigQuery, how does a batch load job from Cloud Storage work, and which formats can it read?
basics
~20 sA BigQuery load job reads files from Cloud Storage and commits them into a table atomically — all rows or none. It reads CSV, newline-delimited JSON, Avro, Parquet and ORC, and carries no per-byte ingestion charge.
What partition types does a BigQuery table support, and how is each declared?
basics
~20 sBigQuery supports three partition types: ingestion-time (the _PARTITIONTIME pseudo-column), time-unit column (a DATE, TIMESTAMP or DATETIME column at hour, day, month or year granularity), and integer range via RANGE_BUCKET. All are declared with PARTITION BY in the DDL.
In BigQuery's on-demand pricing model, what determines how much a query costs?
basics
~10 sUnder BigQuery on-demand pricing you pay per byte processed: the uncompressed size of the columns the query reads, after partition and cluster pruning. The number of rows returned is irrelevant, so LIMIT changes nothing.
In BigQuery, what do ARRAY and STRUCT columns store, and how do you read values inside them?
basics
~20 sA STRUCT is a record of named, typed fields you address with dot notation. An ARRAY is a repeated field holding an ordered list of values in one row; to treat its elements as rows you must UNNEST it.
In an Amazon Redshift provisioned cluster, what does the leader node do that compute nodes do not?
basics
~20 sThe leader node is the only node clients connect to: it parses SQL, builds and compiles the execution plan, ships code to the compute nodes, and merges their partial results. Compute nodes store the data and execute plan segments in parallel.
In Amazon Redshift, what do the DISTSTYLE options KEY, ALL, EVEN and AUTO do?
basics
~20 sDISTSTYLE decides how a Redshift table's rows are spread across compute slices. KEY hashes one column so equal values co-locate, ALL puts a full copy on every node, EVEN round-robins rows, and AUTO lets Redshift pick and change it.
Why is loading Redshift with COPY from S3 faster than many single-row INSERT statements?
basics
~20 sCOPY reads many S3 files at once across all node slices, applies compression, and commits once. Single-row INSERTs pay a commit each and leave 1 MB column blocks nearly empty, so the load crawls and storage balloons.
In Amazon Redshift, what does Spectrum let you query, and what must you create first?
basics
~20 sRedshift Spectrum runs ordinary SQL directly against files in S3 without loading them into the cluster. Before querying you create an external schema that points at a data catalog database and an IAM role, then define external tables over S3 prefixes.
In Amazon Redshift, what is a node slice and why does the total slice count govern parallelism?
basics
~20 sA slice is a partition of a compute node's memory and disk that acts as an independent worker. Redshift spreads every table's rows across all slices and runs each plan segment once per slice, so total slices set the cluster's degree of parallelism.
In ClickHouse, what happens on disk each time you INSERT into a MergeTree table?
basics
~20 sEach inserted block becomes a brand-new immutable data part: a directory of sorted, compressed per-column files plus index files. Existing files are never modified; a background merge process later combines parts into fewer, larger ones.
In ClickHouse, what does the MergeTree engine give you that the Log and Memory engines do not?
basics
~20 sMergeTree stores rows as sorted, compressed, immutable parts merged in the background, and alone supports the sparse index, partitions, TTL and replication. Log engines are index-free append-only files; Memory keeps rows in RAM and loses them on restart.
Why does a ClickHouse MergeTree table start rejecting inserts with "Too many parts"?
basics
~20 sBecause inserts are creating parts faster than background merges can combine them. ClickHouse first delays and then rejects inserts once a partition's active part count crosses the parts_to_delay_insert and parts_to_throw_insert thresholds, protecting query performance and the merge pool.
When a block is inserted into a ClickHouse table, what data can its materialized view's SELECT actually see?
basics
~20 sOnly the rows in the block just inserted. A ClickHouse materialized view runs its SELECT as if that single block were the whole source table, so it never sees existing rows, and merges, mutations and TTL deletions do not trigger it at all.
Why does a ClickHouse materialized view write uniqState(user_id) instead of uniq(user_id)?
basics
~20 sBecause the view aggregates only the block being inserted, its output is partial. The -State combinator stores a mergeable intermediate aggregate instead of a final number, so AggregatingMergeTree can combine partial results from many inserts; readers finish the job with uniqMerge.