Does the Azure Data Explorer optimize the entire query if your base table access is in a function?

Copper Contributor

I am optimizing some Kusto code in which the access to base tables is encapsulated in user defined functions, sometimes several layers of function calls. For example, suppose you have a tabular function GetStuff() which in turn invokes a tabular function GetStuff2() which calls the base Kusto table Stuff. My question is: If I write a Kusto query which involves a join with the tabular function GetStuff(), will the Azure Data Explorer optimizer work to optimize the entire call stack that is involved? In other words, will it behave like views in a relational database where it will create and optimize a query plan for the entire query, first decomposing the view definition, or does the optimization only act at the function definition or query level?

1 Reply

When you call stored function in Kusto - it would be the same as if you would use the functions' "bodies" inline. This means that the function call will be optimized the same way as if the whole query is inlined. Kusto.Explorer (Windows Desktop app) - https://aka.ms/ke can show you the execution tree of the query. Write your query down in the query editor, and use ribbon Tools->Query Analyzer to run it and show you the optimized execution tree of the query. If you have specific question about why certain optimization is not kicking in - feel free to submit a separate question.