$npx -y skills add PatrickGallucci/fabric-skills --skill fabric-lakehouse-views-perf-remediateTroubleshoot Microsoft Fabric materialized lake views (MLV) performance issues including slow refresh, incremental refresh failures, full refresh fallback, Spark job failures, lineage execution errors, data quality constraint violations, and optimal refresh configuration. Use whe
| 1 | # Fabric Materialized Lake Views Performance remediate |
| 2 | |
| 3 | Diagnose and resolve performance issues with materialized lake views (MLVs) in Microsoft Fabric lakehouses. This skill covers refresh optimization, Spark job diagnostics, data quality constraint tuning, and lineage execution remediate. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | - MLV refresh runs are taking longer than expected |
| 8 | - Incremental refresh is falling back to full refresh unexpectedly |
| 9 | - MLV lineage execution shows Failed or Skipped nodes |
| 10 | - Spark jobs for MLV refresh are failing with errors |
| 11 | - "Delta table not found" errors during MLV creation or refresh |
| 12 | - Data quality constraints causing unexpected pipeline failures |
| 13 | - Need to enable or verify optimal refresh configuration |
| 14 | - Custom Spark environment tuning for MLV workloads |
| 15 | - Monitoring and interpreting MLV run history |
| 16 | |
| 17 | ## Prerequisites |
| 18 | |
| 19 | - Microsoft Fabric workspace with Lakehouse items |
| 20 | - Schema-enabled lakehouse (recommended for MLV support) |
| 21 | - Fabric notebook for executing Spark SQL commands |
| 22 | - Workspace Admin or Contributor role for scheduling and monitoring |
| 23 | - Access to Monitor Hub for viewing MLV run details |
| 24 | |
| 25 | ## Quick Diagnostics Checklist |
| 26 | |
| 27 | Run through these checks in order when remediate MLV performance: |
| 28 | |
| 29 | | Step | Check | Action | |
| 30 | | ---- | --------------------- | ------------------------------------------------------------------------- | |
| 31 | | 1 | Identify refresh mode | Verify optimal refresh toggle is enabled in lineage view | |
| 32 | | 2 | Check CDF status | Confirm `delta.enableChangeDataFeed=true` on ALL source tables | |
| 33 | | 3 | Review query patterns | Ensure only supported SQL constructs are used (see supported expressions) | |
| 34 | | 4 | Inspect run history | Open lineage view dropdown to see last 25 runs and their states | |
| 35 | | 5 | Check node failures | Click failed nodes in lineage to view error messages | |
| 36 | | 6 | Review Spark logs | Follow Detailed Logs link to Monitor Hub for Spark error logs | |
| 37 | | 7 | Validate data quality | Check if FAIL constraints are causing "delta table not found" errors | |
| 38 | | 8 | Assess source data | Determine if source has updates/deletes (forces full refresh) | |
| 39 | |
| 40 | ## Step-by-Step Workflows |
| 41 | |
| 42 | ### Workflow 1: Diagnose Slow Refresh |
| 43 | |
| 44 | 1. **Determine current refresh strategy** - Navigate to Manage materialized lake views in the lakehouse ribbon. Check if Optimal refresh toggle is ON. |
| 45 | 2. **Verify change data feed** - Run the diagnostic script to check CDF status on all source tables. See [scripts/check-cdf-status.sql](./scripts/check-cdf-status.sql). |
| 46 | 3. **Check for unsupported expressions** - Review the MLV definition for constructs that force full refresh. See [Supported Expressions](#supported-expressions-for-incremental-refresh). |
| 47 | 4. **Inspect source data patterns** - If source tables have UPDATE or DELETE operations, Fabric always performs full refresh regardless of CDF status. |
| 48 | 5. **Review partition strategy** - Consider adding `PARTITIONED BY` to large MLVs to improve refresh parallelism. |
| 49 | 6. **Attach custom environment** - Configure a custom Spark environment with optimized compute for heavy workloads. See [references/custom-environment-guide.md](./references/custom-environment-guide.md). |
| 50 | |
| 51 | ### Workflow 2: Resolve Failed Refresh Runs |
| 52 | |
| 53 | 1. **Open lineage view** - Navigate to Manage materialized lake views, select the failed run from the dropdown (last 25 runs available). |
| 54 | 2. **Identify failed node** - Click the failed node in the lineage graph. Review the error message in the right-side panel. |
| 55 | 3. **Access Spark logs** - Click the Detailed Logs link to navigate to Monitor Hub. Review Apache Spark error logs. |
| 56 | 4. **Common failure patterns** - See [references/common-failure-patterns.md](./references/common-failure-patterns.md) for resolution steps. |
| 57 | 5. **Retry or recreate** - For transient Spark failures, retry the run. For persistent errors, drop and recreate the MLV. |
| 58 | |
| 59 | ### Workflow 3: Enable Optimal Refresh |
| 60 | |
| 61 | 1. **Enable CDF on all source tables:** |
| 62 | |
| 63 | ```sql |
| 64 | ALTER TABLE bronze.customers SET TBLPROPERTIES (delta.enableChangeDataFeed = true); |
| 65 | ALTER TABLE b |