设想:
5小时后,Kusto表中的数据将更新。
任务:从.NET API调用查询
在查询中,创建一个子查询,并使用该子查询在更大的表
let table1=materialize(
Customer|where CustomerId=="cust-reg-aabb-cc232"|distinct CustomerId,City);
CustomerPurchase
|where CustomerId=="cust-reg-aabb-cc232"
//perform join with table1 and other things
或
let table1=view(){
Customer|where CustomerId=="cust-reg-aabb-cc232"|distinct CustomerId,City};
CustomerPurchase
|where CustomerId=="cust-reg-aabb-cc232"
//perform join with table1 and CustomerPurchase
客户购买和客户数据上进行每5小时后进行更新(添加新行)。更优化的是:创建视图或使用方法。
我仔细阅读了文档,但两者之间的不同之处。
Also since I am implementing an API, is it possible to use
Scenario:
Data in kusto table is updated after 5 hours.
Task: Call query from .net API
In query , create a subquery and use that subquery to perform join on a bigger table
let table1=materialize(
Customer|where CustomerId=="cust-reg-aabb-cc232"|distinct CustomerId,City);
CustomerPurchase
|where CustomerId=="cust-reg-aabb-cc232"
//perform join with table1 and other things
or
let table1=view(){
Customer|where CustomerId=="cust-reg-aabb-cc232"|distinct CustomerId,City};
CustomerPurchase
|where CustomerId=="cust-reg-aabb-cc232"
//perform join with table1 and CustomerPurchase
CustomerPurchase and Customer data is being updated after every 5 hours(new rows being added). What is more optimized : create a view or use the materialize method.
I went through the documentation but could not understand the different between both.
Also since I am implementing an API, is it possible to use materialized view instead of table1?
发布评论
评论(1)
文档很清楚:
关键字
顾名思义,汇总结果已实现,含义 - 存储。
结果正在不断更新,而数据不断摄入。
在您的情况下,似乎没有理由使用
belitialize()
,也没有view
关键字。诸如以下视图(在客户ID上使用过滤器)诸如使用时可能会提高性能,而不是
table1
。更新
以下是几个示例,这些示例证明了 apertialize()
1。x337
“ https://dataexplorer.azure.com/clusters/clusters/help/databases/samples/samples? query=H4sIAAAAAAAAA8tJLVEoUbBVKCjKzCtRqACyihLzUjQMDQwMNK15uUrzMvPzFEp0wAgACmPsbiwAAAA=" rel="nofollow noreferrer">Fiddle
vs.
小提琴
2。i
执行时间:4.4375515
Fiddle
vs.
Execution Time: 2.5313002
Here is an example that demonstrates the benefits of a view
Fiddle
The documentation is quite clear:
materialize
views
The view keyword
Materialized views
As the name suggests, the aggregation results are materialized, meaning - stored.
The results are being updated constantly, while the data keeps being ingested.
In your case, there seems to be no reason to use
materialize()
, nor theview
keyword.A materialized view such as the following (with filter on CustomerId) might improve performance when used instead of
table1
.Update
Here are couple of examples that demonstrate the benefits of materialize()
1.
Fiddle
vs.
Fiddle
2.
Execution Time: 4.4375515
Fiddle
vs.
Execution Time: 2.5313002
Here is an example that demonstrates the benefits of a view
Fiddle