In some situations, customers that are using PowerBI and Direct Query reported performance issues depending how the query has been defined by PowerBI. At DataCon 2025 this June in Seattle, I had the great opportunity to present some performance recomendations in this area.
In some situations, customers that are using Power BI and DirectQuery reported performance issues depending on how the query has been defined by Power BI. At DataCon 2025 this June in Seattle, I had the great opportunity to present some performance recommendations in this area, based on following articles that we published on our blog some time ago:
- Lesson Learned #247: All started with the phrase: In PowerBI Direct Query is slow - Indexed views | Microsoft Community Hub
- Lesson Learned #249: All started with the phrase: In PowerBI Direct Query is slow-Partitioned table | Microsoft Community Hub
- Lesson Learned #250: All started with the phrase: In PowerBI Direct Query is slow-ColumnStore Index | Microsoft Community Hub
In this folder you could find all the materials that we used to deliver this session. This lab helps us better understand where performance gains can be achieved in our database — making it easier to identify what to optimize and how.
Also, using the Copilot feature added in SQL Server Management Studio v.21 I would like to share some prompt that we used during the lab that it was very useful during the troubleshooting scenario that we divided in 3 areas:
- Analysis Phase:
- List all tables in the 'Fact' and 'Dimension' schemas with space usage in MB and number of rows
- List all tables in the 'Fact' and 'Dimension' schemas with their structure, including data types, primary keys, foreign keys and indexes. Then provide optimization suggestions for DirectQuery scenarios in Power BI
- Show the name of the tables and their relation among them
- List all foreign key relationships between tables in the 'Fact' and 'Dimension' schemas, showing the cardinality and referenced columns
- Could you please let me know what is the meaning of every table?
- Describe all schemas in this database, listing the number of tables and views per schema
- Create a textual data model (ER-style) representation showing how all Fact and Dimension tables are connected.
- Maintenance Plans:
-
- List all statistics in the database that have not been updated in the last 7 days, showing table name, number of rows, and last update date
- List all indexes in the database with fragmentation higher than 30%.
- Provide the T-SQL to rebuild each table in the 'Dimension' and 'Fact' schemas in ONLINE mode, and another T-SQL statement for updating automatic statistics
- List all tables with allocated space but zero rows, or with excessive reserved space not used by actual data
-
- Performance Troubleshooting Phase:
-
I have this query, what are the improvements for better performance that we could apply?
-
Please simplify the query and explain it.
-
Explain in plain language what the following SQL query does, including the purpose of each subquery and the final WHERE clause
-
Show a histogram of data distribution for key columns used in joins or filters, such as SaleDate, ProductCategory, or Region
- Can this query be transformed into a schemabound indexed view that pre-aggregates the sales by [Fiscal Month Label] to improve DirectQuery performance?
-