Search code examples
azureazure-data-explorerkqlkusto-explorer

What are stored views in kusto?


While reading the official Kusto Documentation on creating functions, I came across this option to create functions as stored views: Supported properties
Name    Type    Description
docstring   string  A description of the function for UI purposes.
folder  string  The name of a folder used for UI functions categorization.
view    bool    Designates this function as a stored view.
skipvalidation  bool    Determines whether or not to run validation logic on the function, and fail the process if the function isn't valid. The default is false.

I am not able to understand how is it different from a view(which is defined by Kusto as a stored function with 0 parameters) and is it different from materialized views? I tried creating one stored view in ADX and it shows along with the tables but I am not sure if it has a different storage or is it simply a cached result for some table or a separate table altogether?


Solution

  • A stored function/view, unlike a materialized view, doesn't store any data. The logic in it is invoked over the source data each time the function is invoked.

    • To your question - it doesn't involve caching either. unless you're making use of the query results cache when invoking the function/view).

    Regarding your question in the comments:

    • The difference between a stored function and a stored view (a stored function that is created with view = true) are query semantics for special operators such as find, search & union - which will include the view, if its name matches the arguments.