Sub topic 3
How the VertiPaq engine stores and compresses data
This chapter assumes you can build a star schema in Power BI Desktop and write basic DAX measures. You do not need to know anything about database internals.
Why VertiPaq matters for storage modes
VertiPaq is the in-memory columnar engine that answers DAX queries for Import tables and for Direct Lake tables. DirectQuery tables do not use it, because their queries go to the source. Knowing how VertiPaq stores data explains why Import is fast, why model size depends on column choices, and why Direct Lake can reuse the same engine on Delta files.
Columnar storage
A row store keeps all values of one row together. VertiPaq is a column store. It keeps all values of one column together, as a separate structure.
This suits analytics. A query such as total sales by year reads only the Quantity, UnitPrice, and Year columns. It never touches the other 40 columns in the table. Values within a single column are also similar to each other, which makes them compress well.
Three compression techniques
VertiPaq applies several techniques to each column. The three below do most of the work.
| Technique | What it does | Works best when |
|---|---|---|
| Dictionary encoding | Stores each distinct value once and replaces every occurrence with a small integer ID | A column has few distinct values, such as country or status |
| Value encoding | Stores numbers as offsets from a base value, using fewer bits | Integer columns with a narrow range |
| Run-length encoding | Stores a value and a repeat count instead of repeating it | Sorted or repetitive columns |
The engine picks an encoding for each column, usually by sampling the first rows it loads. It also chooses a row order that makes run-length encoding more effective.
Cardinality drives size
Cardinality is the number of distinct values in a column. It is the main factor in how large a column becomes.
- A
Countrycolumn with 200 distinct values compresses to a tiny dictionary and narrow IDs. - A
TransactionIdor a datetime column with second precision has nearly one distinct value per row. The dictionary is almost as large as the raw data, and compression gains little.
Relationships and the query path
VertiPaq stores relationships as internal structures that map a key in one table to rows in another. Joins in a star schema are therefore cheap, as long as key columns are compact. Integer surrogate keys compress better than long text keys.
When a visual runs a query, the formula engine plans it and the storage engine scans the compressed columns. The scan runs in parallel across segments of about one million rows. This is why a well-built Import model can aggregate hundreds of millions of rows in well under a second.
Memory and Direct Lake
Import mode holds the compressed columns in memory for the whole model. If the model is too large for the capacity, refresh fails or the model cannot load.
Direct Lake uses the same engine but loads only the columns a query needs, reading them from Delta files. Later chapters cover that. Here, the point is that the compression rules in this chapter still decide how much memory those columns use.
Exercise
A fact table has a OrderDateTime column with second-level precision and 50 million distinct values. Model size is large. Name two changes that would reduce it and explain why they help.
Show answer
Split the column into a date column and a time column, or round it to the hour or day. Both lower cardinality, so the dictionary is smaller and the integer IDs need fewer bits. You could also remove the column if no visual or measure uses it.