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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
michaelsh
Kudo Kingpin
Kudo Kingpin

Using Table.Buffer

I am connecting to a Folder that has a bunch of JSON files.

I use a custom function to combine the files.

Then I do all kinds of stuff, like dynamycally extracting the column names from nested json lists, etc.

I feel Table.Buffer / List.Buffer can speed things up.

I've read this:

https://www.thebiccountant.com/speedperformance-aspects/

and this:

https://blog.crossjoin.co.uk/2015/05/05/improving-power-query-calculation-performance-with-list-buff...

And I still wonder - when shoud I use Table.Buffer?

Why not put it in the beginning of my query (just after I run the custom function) - and that's it - all will sit in the memory?

 

1 ACCEPTED SOLUTION

Hi @michaelsh 

If you buffer a table in a step, then transform that table in some way, then this new transformed table isn't the one that is buffered. 

So in subsequent steps you can't continue to refer to the buffered table from your 1st step.

To be honest the workings of the Buffer functions aren't cleary undestood by anyone other than the Microsoft dev team.  I've never read a definitive explanation of how or when to use them, hence Pat's suggestion to 'just try them out'.

Cheers

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

7 REPLIES 7
mahoneypat
Employee
Employee

The best way is to just try it out and see if it makes things significantly faster.  Hard to predict if it will have an impact as sometimes is does that type of optimization on its own.  The key thing is to use it within the same query where it is referenced multiple times (which your proposal does).

Regards,
Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


PhilipTreacy
Super User
Super User

Hi @michaelsh 

You could do this, provided that the table you are referencing does not get changed in any way in subsequent steps.  This is not usually the case though, so every time a table is transformed resulting in a new table, you'd need to use Table.Buffer again.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


I see @PhilipTreacy .

But if the subsequent steps modify the table, is it still better to Buffer just the first one, so that the subsequent steps do not go back to original data source, but just to the first buffered table?

I am still missing something...

Maybe you can provide a sample?

Thank you

Hi @michaelsh 

If you buffer a table in a step, then transform that table in some way, then this new transformed table isn't the one that is buffered. 

So in subsequent steps you can't continue to refer to the buffered table from your 1st step.

To be honest the workings of the Buffer functions aren't cleary undestood by anyone other than the Microsoft dev team.  I've never read a definitive explanation of how or when to use them, hence Pat's suggestion to 'just try them out'.

Cheers

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


v-alq-msft
Community Support
Community Support

 Hi, @michaelsh 

 

You may use 'Table.Buffer'/'List.Buffer' when your table or list will br referenced multiple times(like in 'Table.SelectRows', 'List.Generate', 'List.Accumulate').

 

In the following example, table 'a' is referenced mutiple times.

=Table.AddColumn(a,"Custom",each Table.RowCount(Table.SelectRows(a,(x)=>x[Subject]=[Subject] and x[Score]=[Score]))+1)

 

Then you may use 'Table.Buffer' to store the table in memory to improve the performance. 

A=Table.Buffer(a),
Table.AddColumn(A,"Custom",each Table.RowCount(Table.SelectRows(A,(x)=>x[Subject]=[Subject] and x[Score]=[Score]))+1)

 

Hope it helps for you to understand 'Table.Buffer'/'List.Buffer'.

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-alq-msft Could you please explain why buffering once is not enough?  Why does one need to repeatedly buffer a table if it 'is referenced multiple times' as you say?

Yes, @v-alq-msft , this is helpful, thank you!

What I don't get - is why shouldn't I just write Table.Buffer as my second step and then all other steps will just reference this buffered table.

Will it work?

Why not do it? (consider I have enough memory)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.