Monitor and Optimize an Analytics Solution · Topic 5 of 5

Optimizing Pipelines, Warehouses, Real-Time Items and Queries

DP-700 performance: tune Copy activity and ForEach, warehouse statistics and loads, Eventstream and Eventhouse policies, and fast KQL and T-SQL queries.

  • 6 min
In a nutshell
  • Pipelines: incremental loads, parallel copy, source partitioning and parallel ForEach.
  • Warehouses: batch loads, current statistics, small data types, no SELECT *.
  • Eventhouse: caching policy for hot data, retention to limit size, materialized views for repeated aggregates.

What it is

Every Fabric engine gets faster for the same reasons: it reads less data, moves data in parallel, and does repeated work once. Pipelines gain from parallel copies and incremental loads, warehouses from statistics and large batched loads, Eventhouses from caching and precomputed views, and every query from filtering early.

Optimization also saves capacity units, because Fabric charges compute for the work each item does.

Slow itemMeasureMonitor hub, query insightsFind bottleneckscan, shuffle, small batchesApply fixMeasure again

How it works

Optimize a pipeline

TechniqueEffect
Incremental loads instead of full loadsCopies only new or changed rows
Filter and select columns at the sourceLess data read and transferred
Copy activity intelligent throughput optimization and degree of copy parallelismMore compute and parallel threads for large copies
Source partition options (for example dynamic range on a numeric or date column)Reads a large table in parallel slices
ForEach with sequential off and a batch countRuns iterations in parallel, up to 50 at a time
Fewer, larger activitiesLess overhead per activity run
Push transformations to the engineUse a stored procedure, notebook or dataflow rather than row-by-row activities

Parallelism has limits: a source database or API can throttle or slow down under too many parallel reads, so raise it step by step.

Optimize a data warehouse

AreaPractice
StatisticsAutomatic statistics are created as queries run; after large loads, update them or create them on key join and filter columns
LoadingLoad in large batches with COPY INTO, INSERT ... SELECT or CREATE TABLE AS SELECT; avoid many single-row INSERT statements
Data typesUse the smallest suitable types and sensible varchar lengths
QueriesSelect only needed columns, filter early, and join on integer keys
InvestigationUse queryinsights.long_running_queries and queryinsights.frequently_run_queries to find what to tune
COPY INTO dbo.Sales
FROM 'https://contoso.blob.core.windows.net/sales/2026/*.parquet'
WITH (FILE_TYPE = 'PARQUET');

CREATE STATISTICS stats_Sales_CustomerKey ON dbo.Sales (CustomerKey) WITH FULLSCAN;
UPDATE STATISTICS dbo.Sales (stats_Sales_CustomerKey);

Each single-row insert writes new small Parquet files and log entries, so trickle inserts are slow and fragment the table. The warehouse compacts files automatically in the background, but batching is still much faster.

The first run of a query can be slower because data is not yet cached on the compute nodes. Compare repeated runs before deciding a change helped.

Optimize Eventstream and Eventhouse

Eventstream

  • Filter out unwanted events and drop unneeded fields early, so less data flows to every destination.
  • Use direct ingestion to an Eventhouse when no in-flight processing is needed; it has fewer steps.
  • Send events from a high-volume source to one eventstream and branch it to several destinations, rather than reading the same source many times.

Eventhouse

Policy or featureUse
Caching policyKeeps the most queried period, such as 30 days, on fast local storage (hot cache)
Retention policyDeletes data older than you need, reducing storage and scan size
Update policyParses and enriches at ingestion, so queries do not repeat the work
Materialized viewPrecomputes aggregations queried again and again
Ingestion batching or streaming ingestionTrades latency for efficiency; streaming ingestion lowers latency for small, frequent data
Minimum consumption (Capacity Planner)Keeps the Eventhouse always active, so queries do not wait a few seconds for it to resume after it suspends when idle
.alter table Telemetry policy caching hot = 30d

.alter-merge table Telemetry policy retention softdelete = 365d

Queries over data outside the hot cache still work, but they read from slower storage.

Optimize query performance

KQL

  • Filter on the datetime column first, such as where Timestamp > ago(1h).
  • Use has (whole term, uses the index) rather than contains (substring scan) where possible, and == rather than the case-insensitive =~.
  • project only the columns you need and summarize before a join.
  • Put the smaller table on the left side of a join, or use lookup for a dimension table.
Logs
| where Timestamp > ago(1h)
| where Message has "timeout"
| summarize Errors = count() by Service
| lookup kind=leftouter ServiceOwners on Service

T-SQL and Spark SQL

  • Avoid SELECT * and wrapping filter columns in functions, such as WHERE YEAR(OrderDate) = 2026; write WHERE OrderDate >= '2026-01-01' AND OrderDate < '2027-01-01' instead.
  • Keep statistics current in the warehouse; keep lakehouse tables compacted and V-Ordered so the SQL analytics endpoint and Direct Lake read them quickly.

A worked example

A nightly pipeline copies a 500 million row table in five hours, and a KQL dashboard over the copied logs is slow.

The engineer switches to an incremental load on ModifiedDate, sets a dynamic range partition on the source key, and raises copy parallelism; the load drops to minutes. In the Eventhouse, a caching policy of 30 days covers the dashboard's range, a materialized view precomputes hourly counts, and queries now filter on Timestamp first and use has instead of contains.

How the exam asks about this

  • "A ForEach copies 40 tables one after another." Turn off sequential and set a batch count.
  • "Thousands of single-row inserts make a warehouse load slow." Load in batches with COPY INTO or INSERT ... SELECT.
  • "Dashboards query the last 14 days of an Eventhouse table and are slow." Set a caching policy covering at least 14 days, and consider a materialized view.

What to remember for the exam

  • Pipelines: incremental loads, parallel copy, source partitioning and parallel ForEach.
  • Warehouses: batch loads, current statistics, small data types, no SELECT *.
  • Eventhouse: caching policy for hot data, retention to limit size, materialized views for repeated aggregates.
  • KQL: time filter first, has over contains, smaller table on the left of a join.
  • Measure before and after; the first query run may be slower than later runs.
Watch out

Raising parallelism without checking the source can overload it. A throttled source makes the copy slower, not faster.

Common mistakes

Loading a warehouse with row-by-row inserts from a ForEach. Use one set-based load instead.

Using contains for word searches in large log tables. has uses the term index and is much faster.

Setting the hot cache shorter than the period dashboards query. Every refresh then reads cold storage.

Check yourself

  • How do you make a ForEach run its iterations in parallel?

    Turn off the Sequential setting and set a batch count for how many iterations run at once.

  • Why are many single-row inserts slow in a Fabric warehouse?

    Each insert writes small files and log entries; batched loads such as COPY INTO or INSERT ... SELECT write far fewer, larger files.

  • Which Eventhouse policy keeps recent data on fast storage for queries?

    The caching policy, which defines the hot cache period.

Topic 5 of 5 in Monitor and Optimize an Analytics Solution

Test yourself on Monitor and Optimize an Analytics Solution

The full Microsoft DP-700 question bank has 645 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.