Application Insights Analytics 执行子选择

Application Insights Analytics doing sub selects

我正在将此参考资料 documentation 用于 Application Insights。

如何使用不同查询的输出执行子select?

//Query 1
Events 
| where  Timestamp >= ago(30min) and Data contains('SomeString')
| project TraceToken

//I would like to use the first query's output in the subselect here.
Events 
| where TraceToken in ({I would like to use the First query's output here.})

在这种情况下加入更好。哪个性能更好。

您可以使用 let 语句来实现。

这是来自 Analytics documentation 的示例,希望对您有所帮助:

let topCities =  toscalar ( // convert single column to value
   requests
   | summarize count() by client_City 
   | top 4 by count_ 
   | summarize makeset(client_City));
requests
| where client_City in (topCities) 
| summarize count() by client_City;

编辑:默认情况下,makeset()函数返回的最大元素数为128。对于较大的数据集,应指定MaxSetSize。