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
- 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.
How it works
Optimize a pipeline
| Technique | Effect |
|---|---|
| Incremental loads instead of full loads | Copies only new or changed rows |
| Filter and select columns at the source | Less data read and transferred |
| Copy activity intelligent throughput optimization and degree of copy parallelism | More 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 count | Runs iterations in parallel, up to 50 at a time |
| Fewer, larger activities | Less overhead per activity run |
| Push transformations to the engine | Use 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
| Area | Practice |
|---|---|
| Statistics | Automatic statistics are created as queries run; after large loads, update them or create them on key join and filter columns |
| Loading | Load in large batches with COPY INTO, INSERT ... SELECT or CREATE TABLE AS SELECT; avoid many single-row INSERT statements |
| Data types | Use the smallest suitable types and sensible varchar lengths |
| Queries | Select only needed columns, filter early, and join on integer keys |
| Investigation | Use 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 feature | Use |
|---|---|
| Caching policy | Keeps the most queried period, such as 30 days, on fast local storage (hot cache) |
| Retention policy | Deletes data older than you need, reducing storage and scan size |
| Update policy | Parses and enriches at ingestion, so queries do not repeat the work |
| Materialized view | Precomputes aggregations queried again and again |
| Ingestion batching or streaming ingestion | Trades 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 thancontains(substring scan) where possible, and==rather than the case-insensitive=~. projectonly the columns you need andsummarizebefore ajoin.- Put the smaller table on the left side of a
join, or uselookupfor 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 asWHERE YEAR(OrderDate) = 2026; writeWHERE 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 INTOorINSERT ... 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,
hasovercontains, smaller table on the left of a join. - Measure before and after; the first query run may be slower than later runs.
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 INTOorINSERT ... SELECTwrite 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.