多个条款与条款vs.' and'在库斯托

发布于 2025-02-06 09:38:03 字数 256 浏览 1 评论 0原文

在性能方面,以下查询

ResourceEvents
| where ResourceType == "Foo" and EventType == "Bar"

几乎与记录依次过滤的记录相同

ResourceEvents
| where ResourceType == "Foo"
| where EventType == "Bar"

,或者执行两个搜索而不是一个组合搜索?

In terms of performance, is the following query

ResourceEvents
| where ResourceType == "Foo" and EventType == "Bar"

practically the same as

ResourceEvents
| where ResourceType == "Foo"
| where EventType == "Bar"

Or are the records filtered sequentially, performing two searches instead of one combined?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一个人练习一个人 2025-02-13 09:38:03

在语义和性能方面,这两种选项都是等效的

both options are equivalent in terms of semantics and performance

枯寂 2025-02-13 09:38:03

添加到Yoni的答案中,您可以通过查看查询计划自己检查一下。

.show queryplan  <|
StormEvents
| where State == "TEXAS" and EventType == "Flood"


.show queryplan  <|
StormEvents
| where State == "TEXAS" 
| where EventType == "Flood"

计划是等效的。

Adding to Yoni's answer, you can check it yourself by looking at the query plan.

.show queryplan  <|
StormEvents
| where State == "TEXAS" and EventType == "Flood"


.show queryplan  <|
StormEvents
| where State == "TEXAS" 
| where EventType == "Flood"

The plans are equivalent.

把人绕傻吧 2025-02-13 09:38:03

在您的确切情况下,它似乎是等效的。但是,如果您进行大量解析,请更好地使用链式|其中子句与|在哪里...和....
也许看看&gt; “在动态对象中查找稀有键/值”。

谢谢@sheldonzy!我不知道.show queryplan。可悲的是使用日志分析时似乎无法使用。但是可以通过在

In your exact scenario, it seems to be equivalent; but if you have heavy parsing, better use chained | where clause compare to a | where ... and ....
Maybe have a look at kql query best practices > 'Lookup for rare keys/values in dynamic object'.

Thanks @sheldonzy! I didn't knew about .show queryplan. It seems to not be available when using log analytics sadly; but some testing can be achieved by running queries on Microsoft test ADX which is freely available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文