1

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?

.create-or-alter function with (folder = "Stuff", docstring = "Stuff", skipvalidation = "true") GetStuff() {

ABaseTable
| join GetStuff2()
| more logic
…
}

.create-or-alter function with (folder = "Stuff", docstring = "More Stuff", skipvalidation = "true") GetStuff2() {

AnotherBaseTable
| join GetStuff 
| more logic
…
}

Here is the query:

GetStuff()
| join YetAnotherBaseTable
….

This type of query doesn't seem to be optimized.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.