Forum Discussion
Performance issue: query much slower when using the result of another query as parameter
- 2 years ago
Hi
Try with List.Buffer
let Source = Excel.CurrentWorkbook(){[Name="Table18"]}[Content], ListBuffer = List.Buffer("DATADEF-PAND-query"), #"Merged Columns" = Table.CombineColumns(Source,ListBuffer,Combiner.CombineTextByDelimiter(" | ", QuoteStyle.None),"PAND") in #"Merged ColumnsStéphane
Hi
Try with List.Buffer
let
Source = Excel.CurrentWorkbook(){[Name="Table18"]}[Content],
ListBuffer = List.Buffer("DATADEF-PAND-query"),
#"Merged Columns" = Table.CombineColumns(Source,ListBuffer,Combiner.CombineTextByDelimiter(" | ", QuoteStyle.None),"PAND")
in
#"Merged Columns
Stéphane
Hi slorin
Your solution works really well!
My powerqeury became so fast that I even have some time left to ask some other stupid questions... 🙂
What I really don't understand is the difference in performance between
1. parcels-manual
just by using the GUI, combining 2 columns "Capakey" and "Partnumber":
let
Source = Excel.CurrentWorkbook(){[Name="Table18"]}[Content],
#"Merged Columns" = Table.CombineColumns(Source,{"Capakey", "Partnumber"},Combiner.CombineTextByDelimiter(" | ", QuoteStyle.None),"PAND")
in
#"Merged Columns"
2. parcels-fixed
First, I defined a list "DATADEF-PAND-fixed"
let
#"Result" = {"Capakey", "Partnumber"}
in
#"Result"that I use in my query "parcels-fixed"
let
Source = Excel.CurrentWorkbook(){[Name="Table18"]}[Content],
#"Merged Columns" = Table.CombineColumns(Source,#"DATADEF-PAND-fixed",Combiner.CombineTextByDelimiter(" | ", QuoteStyle.None),"PAND")
in
#"Merged Columns"
Do I need to conclude that calling any function (i.e. "#DATADEF-PAND-fixed") always causes a delay, even when this function doesn't do anything?
And I this function in the above example excecuted for every record in my dataset? Or why does it cause so much delay?
Is there any drawback on buffering? Or should I always buffer lists? And if so, why is this not the standard behaviour?
The documentation is very sparse on this
List.Buffer - PowerQuery M | Microsoft Learn
The documentation for Table.buffer is a little bit more elaborated
Table.Buffer - PowerQuery M | Microsoft Learn
Here I can read
In some cases, it can make your queries run more slowly due to the added cost of reading all the data and storing it in memory
So I'm a bit confused when and when not to use the buffer....
kind regards
bartplessers