Monitor Performance & Query Execution in Fabric Warehouse
Monitoring performance and query execution in Microsoft Fabric Warehouse is essential for optimizing resource usage, identifying bottlenecks, and tuning SQL workloads. In this tutorial, we’ll walk through powerful system views and dynamic management queries you can use for real-time and historical insights.
🔍 Query Insights Views in Fabric
Microsoft Fabric provides specialized views to track query and session behavior:
queryinsights.exec_requests_history
– Tracks historical query executionsqueryinsights.exec_sessions_history
– Tracks session metadataqueryinsights.frequently_run_queries
– Identifies most commonly executed queriesqueryinsights.long_running_queries
– Lists slowest queries for optimization
SELECT * FROM queryinsights.long_running_queries;
🛠️ Using SQL DMVs for Live Monitoring
Dynamic Management Views (DMVs) offer real-time insight into query activity:
sys.dm_exec_requests
– Tracks currently running queriessys.dm_exec_sessions
– Lists active sessionssys.dm_exec_connections
– Shows active client connections
SELECT
r.session_id,
r.status,
r.start_time,
r.command,
r.cpu_time,
r.total_elapsed_time AS elapsed_ms,
r.reads,
r.writes,
t.text AS query_text,
s.program_name,
s.login_name,
s.host_name
FROM sys.dm_exec_requests r
JOIN sys.dm_exec_sessions s ON r.session_id = s.session_id
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE r.status = 'running'
ORDER BY r.total_elapsed_time DESC;
Optionally, you can use the KILL
command to stop long-running or blocked sessions (admin permission required):
KILL 56;
✅ Best Practices
- Use
queryinsights
views for historical trends and usage stats - Use DMVs for real-time analysis of live workloads
- Investigate long-running queries and optimize indexes or logic
- Periodically review session and resource usage patterns