查询一致性Query consistency

Kusto 支持两种查询一致性模型:强一致性查询和弱一致性查询。Kusto supports two query consistency models: strong and weak.

强一致性查询(默认)具有“读取我的更改”保证。Strongly consistent queries (default) have a "read-my-changes" guarantee. 如果你发送控制命令并收到“命令已成功完成”的确认,那么可以保证紧随其后的任何查询都会观察到该命令的结果。If you send a control command and receive acknowledgment that the command has completed successfully, then you'll be guaranteed any query immediately following will observe the results of the command.

必须由客户端显式启用的弱一致性查询没有该保证。Weakly consistent queries that must be explicitly enabled by the client, don't have that guarantee. 进行查询的客户端可能会在更改与反映这些更改的查询之间观察到一些延迟(通常为 1-2 分钟)。Clients making queries might observe some latency (usually 1-2 minutes) between changes and queries reflecting those changes.

弱一致性查询的优点在于,它可以减少处理数据库更改的群集节点上的负载。The advantage of weakly consistent queries, is that it reduces the load on the cluster node that handles database changes. 通常,我们建议你首先尝试强一致性模型。In general, we recommend that you first try the strongly consistent model. 仅在必要时切换到弱一致性查询。Switch to using weakly consistent queries only if necessary.

若要切换到弱一致性查询,请在进行 REST API 调用时设置 queryconsistency 属性。To switch to weakly consistent queries, set the queryconsistency property when making a REST API call. .NET 客户端的用户还可以在 Kusto 连接字符串中设置它,也可以在客户端请求属性中将其设置为标志。Users of the .NET client can also set it in the Kusto connection string or as a flag in the client request properties.