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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
richard-powerbi
Post Patron
Post Patron

Does Table.AddKey break query folding?

From below links I learned that assigning keys can greatly improve performance.

https://blog.crossjoin.co.uk/2015/09/15/referencing-individual-cell-values-from-tables-in-power-quer...

https://blog.crossjoin.co.uk/2018/03/16/improving-the-performance-of-aggregation-after-a-merge-in-po...

 

Let's say I have several queries with steps that maintain query folding to an SQL server. Then I want to merge these queries into one table. There are some SQL tables that already have a key assignment, but there are also tables that lack key assignments. So I thought, let's assign these keys, but then I noticed it breaks the query folding. What would be better practice, assiging keys and break query folding, or assign no keys and keep query folding? Or can I make use of both in a different way?

 

 

 

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @richard-powerbi 

As tested, we know that some functions prevent the query folding taking place, like Table.AddKey, Table.Buffer.

 

As the author of your first link said, 

There aren’t any general rules I can give you though, you just need to make sure you test thoroughly.

Besides from the test of this blog, sometimes executing queries inside the Power Query engine itself is better than query folding.

Thus, it's hard to say which is unconditionally better.

 

We could make a test to monitor the performance of Power Query when running these queries.

There are different monitor tools for different kinds of data sources.

https://blog.crossjoin.co.uk/2018/07/16/process-monitor-power-query/

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.