Home

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

%3CLINGO-SUB%20id%3D%22lingo-sub-708521%22%20slang%3D%22en-US%22%3EDoes%20the%20Azure%20Data%20Explorer%20optimize%20the%20entire%20query%20if%20your%20base%20table%20access%20is%20in%20a%20function%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-708521%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20optimizing%20some%20Kusto%20code%20in%20which%20the%20access%20to%20base%20tables%20is%20encapsulated%20in%20user%20defined%20functions%2C%20sometimes%20several%20layers%20of%20function%20calls.%20For%20example%2C%20suppose%20you%20have%20a%20tabular%20function%20GetStuff()%20which%20in%20turn%20invokes%20a%20tabular%20function%20GetStuff2()%20which%20calls%20the%20base%20Kusto%20table%20Stuff.%20My%20question%20is%3A%20If%20I%20write%20a%20Kusto%20query%20which%20involves%20a%20join%20with%20the%20tabular%20function%20GetStuff()%2C%20will%20the%20Azure%20Data%20Explorer%20optimizer%20work%20to%20optimize%20the%20entire%20call%20stack%20that%20is%20involved%3F%20In%20other%20words%2C%20will%20it%20behave%20like%20views%20in%20a%20relational%20database%20where%20it%20will%20create%20and%20optimize%20a%20query%20plan%20for%20the%20entire%20query%2C%20first%20decomposing%20the%20view%20definition%2C%20or%20does%20the%20optimization%20only%20act%20at%20the%20function%20definition%20or%20query%20level%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-708521%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Data%20Explorer%20(Kusto)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKusto%20language%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETools%20%26amp%3B%20Editors%20(Kusto%20web%20explorer%20%26amp%3B%20Kusto%20explorer)%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715670%22%20slang%3D%22en-US%22%3ERe%3A%20Does%20the%20Azure%20Data%20Explorer%20optimize%20the%20entire%20query%20if%20your%20base%20table%20access%20is%20in%20a%20functio%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715670%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20you%20call%20stored%20function%20in%20Kusto%20-%20it%20would%20be%20the%20same%20as%20if%20you%20would%20use%20the%20functions'%20%22bodies%22%20inline.%20This%20means%20that%20the%20function%20call%20will%20be%20optimized%20the%20same%20way%20as%20if%20the%20whole%20query%20is%20inlined.%20Kusto.Explorer%20(Windows%20Desktop%20app)%20-%20%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fke%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2Fke%3C%2FA%3E%20can%20show%20you%20the%20execution%20tree%20of%20the%20query.%20Write%20your%20query%20down%20in%20the%20query%20editor%2C%20and%20use%20ribbon%20Tools-%26gt%3BQuery%20Analyzer%20to%20run%20it%20and%20show%20you%20the%20optimized%20execution%20tree%20of%20the%20query.%20If%20you%20have%20specific%20question%20about%20why%20certain%20optimization%20is%20not%20kicking%20in%20-%20feel%20free%20to%20submit%20a%20separate%20question.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Dan_Tyack
Occasional Visitor

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.

Related Conversations
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Edge insider Dev bypasses IE mode website list
HotCakeX in Enterprise on
4 Replies