Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
joshua1990
Post Prodigy
Post Prodigy

Refresh Duration - Query Folding vs SQL

Let's assume we have a very large table that is extracted via the ODBC connector using an SQL command like:

SELECT 
A as "Time",
....
FROM DB
WHERE
A >= '01.01.2010'

From a performance point of view, would it be beneficial to use query folding here?
I have made the comparison and it does look like query folding extracts the data faster.
But before I extract every table using query folding, I would like to hear your opinion first. 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Your issue isn't SQL code vs Query Folding, it is ODBC vs a true SQL connector.

There should be no difference in using SQL code vs Query Folding - assuming the code generated by Query Folding is the same. The end result is the SQL server does the work.

I do not recommend using SQL statements directly though as it can present security issues in the Gateway if used, plus it prevents Incremental Refresh from working, as well as additional Query Folding in Power Query. Even if the statement could be folded, PQ cannot take your code and modify it with its additional statements. So 100% of remaining code happens in the mashup engine.

If you need to use SQL code, create a view on the server and connect PQ to that.

But avoid ODBC. Really slows things down.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

Your issue isn't SQL code vs Query Folding, it is ODBC vs a true SQL connector.

There should be no difference in using SQL code vs Query Folding - assuming the code generated by Query Folding is the same. The end result is the SQL server does the work.

I do not recommend using SQL statements directly though as it can present security issues in the Gateway if used, plus it prevents Incremental Refresh from working, as well as additional Query Folding in Power Query. Even if the statement could be folded, PQ cannot take your code and modify it with its additional statements. So 100% of remaining code happens in the mashup engine.

If you need to use SQL code, create a view on the server and connect PQ to that.

But avoid ODBC. Really slows things down.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors