DP-700: how to implement compression and columnar formats in Fabric
I will show how to implement and leverage columnar formats and compression in tables in Microsoft Fabric. This skill is useful for the DP-700 exam because optimizing storage and performance is a core task of a Data Engineer; in practice it reduces costs and speeds up analytical queries. I will also give concrete examples and practical steps so you can test different options in labs or controlled environments before applying them to production.
What you need to know
Columnar storage formats (for example Parquet, Delta) and compression schemes (such as ZSTD, Snappy) influence three essential aspects: I/O, CPU and latency. In analytical workloads, columnar storage allows reading only the needed columns, substantially reducing bytes read and improving throughput. In Fabric, tables in Lakehouse/OneLake typically use Parquet- or Delta-based files; the query engine (Synapse, Kusto) accesses columnar blocks and applies column-wise decompression as needed.
Conceptual example: a 100 GB table with 50 columns where queries typically request 5 columns will benefit greatly from the columnar format, because only ~10% of the data is read in sequential I/O. If you apply efficient compression (for example ZSTD at a medium level) you can reduce on-disk size to something like 20–30 GB — depending on cardinality and column types. Decompression adds CPU overhead (typically 5–30% additional for ZSTD vs lighter Snappy), but the I/O gain compensates for queries that were I/O-bandwidth bound. In environments where storage is billed per GB (for example OneLake), reducing 70–80 GB can translate into tens of euros/month for large datasets.
How it works
Key steps to implement compression and columnar formats in Fabric:
- Assess the query pattern: identify most-read columns, cardinality and types (string, numeric, datetime). Use samples of execution plans and telemetry metrics to quantify: for example, 60% of queries access the date, product and value columns.
- Choose format: Parquet for broad compatibility; Delta for scenarios that need ACID, version history and merges; in Kusto (for interactive analysis) the engine uses optimized columnar blocks. Parquet is excellent for ETL/ELT pipelines, Delta facilitates upsert-type operations and time travel.
- Choose compression scheme: Snappy is fast and consumes little CPU (useful for hot data and interactive latency); ZSTD and Brotli offer better compression ratios (2–5x) but use more CPU. As a practical rule, consider Snappy for real-time ingestion and ZSTD for cold historical storage.
- Partition and sort: combining with compression maximizes gains. Partitioning reduces reads by limiting files to scan; sorting (ordering by frequently filtered columns) improves compression because similar values are close and dictionary or run-length compression becomes more effective.
- Configure on write: apply compression options when exporting/saving Parquet files or when configuring Delta tables/ingestion pipelines. Also configure row group size (for example 64–256 MB) to optimize sequential reads and latency.
Practical example with Dataflow / Spark (simplified pseudocode):
# Em Spark (PySpark) escrevendo para OneLake/ADLS em formato Parquet com compressão ZSTD
df.write \
.mode('overwrite') \
.option('compression', 'zstd') \
.parquet('abfss://datalake@contoso.dfs.core.windows.net/curated/sales')
# Para Delta
df.write \
.format('delta') \
.option('compression', 'snappy') \
.mode('append') \
.save('/mnt/oneLake/warehouse/delta/sales')
In Fabric, when creating Dataflows or pipelines, check the sink options to set format and compression algorithm. For external tables based on Parquet, the resulting file incorporates those options and downstream engines benefit from the compression when reading.
In practice
Recommended practical plan to validate options in a controlled environment:
- Run query analysis: collect execution plans and identify most-used columns. Use monitoring tools to measure I/O read and CPU per query.
- Create a representative sample set (1–5% of the data). For example, from a table with 10M rows, select 100k–500k rows ensuring temporal and category distribution.
- Write that sample in different configurations (Parquet+Snappy, Parquet+ZSTD, Delta+Snappy) and produce files with varied row group/partition sizes (64 MB, 128 MB, 512 MB).
- Run benchmarks: measure query time, I/O read, CPU consumption and estimated storage cost. Record metrics such as percent I/O reduction and latency variation (for example, ZSTD can reduce I/O by 60% but increase CPU by 20%).
- Choose the configuration that gives the best time/cost trade-off for your SLA and document the decision with concrete numbers (for example: Parquet+ZSTD, monthly partitions, row group 128 MB — reduces storage cost by 55% and keeps latency < 2 s for typical queries).
Engineering tip: if you have high-cardinality columns (for example unique IDs), dictionary compression loses effectiveness; in these cases, focus sorting and compression on low-cardinality columns (state, category) and keep IDs as compact integers. Parquet files sized between 100–500 MB tend to offer a better balance between parallelism and overhead.
Common mistakes
- Trying to use overly aggressive compression on hot data: increases latency and CPU, degrading performance for interactive queries. For example, Brotli at maximum level can double read latency.
- Not testing with real workloads: choices based only on on-disk size can fail when queries require low latency or high concurrency.
- Ignoring alignment between partitions and compression: partitions that are too small (for example < 50 MB) generate metadata overhead and reduce compression effectiveness; partitions too large prevent efficient parallelism.
How to practice
Practice with the official labs and the OFFICIAL Microsoft Practice Assessment (free) for DP-700; also use the Microsoft study guide (free) to review topics related to storage and performance optimization. Implement the mentioned examples in a test workspace in Fabric, record metrics before/after and iterate. Do not use or search for 'exam dumps'.
In summary
- Columnar formats (Parquet/Delta) reduce I/O by reading only needed columns and enable efficient compression.
- Choosing compression is a trade-off between space and CPU; test with real workloads and quantify gains (I/O reduction, CPU increase, cost per GB).
- Partitioning and correct sorting increase compression effectiveness and speed up queries; optimize row group/file for your throughput.
- Document choices and automate benchmarks to maintain performance over time and justify engineering and cost decisions.