作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
执行以下查询时,我收到错误
按 c.Agent.LastStateChangeUnixTime desc,c.Priority asc 从 c order 中选择 *
The order by query does not have a corresponding composite index that it can be served from
我的综合索引有错吗?还是我还漏掉了其他东西?
我的索引设置是:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
],
"compositeIndexes": [
[
{
"path": "/Priority",
"order": "descending"
},
{
"path": "/Agent/LastStateChangeUnixTime",
"order": "ascending"
}
]
]
}
示例对象:
{
"Agent": {
"TenantId": 999999,
"PrimaryState": "Null",
"PendingState": "Null",
"LastStateChange": "2020-01-18T05:48:11.5397269+00:00",
"LastStateChangeUnixTime": 1579326491,
"Notes": null,
"AgentId": 123,
"id": "agent-123"
},
"AgentId": 123,
"SkillName": "English",
"id": "SkillName123",
"Priority": 10,
"_rid": "SVIMANKqJboCAAAAAAAAAA==",
"_self": "dbs/SVIMAA==/colls/SVIMANKqJbo=/docs/SVIMANKqJboCAAAAAAAAAA==/",
"_etag": "\"2200819a-0000-0700-0000-5e229c1d0000\"",
"_attachments": "attachments/",
"_ts": 1579326493
}
最佳答案
是的,您的复合索引对于此查询不正确。它们出现的顺序很重要,因此 WHERE 子句需要匹配顺序。
更改以下内容或将以下内容添加到您的综合索引中。
"compositeIndexes": [
[
{
"path": "/Agent/LastStateChangeUnixTime",
"order": "descending"
},
{
"path": "/Priority",
"order": "ascending"
}
]
]
关于azure - 错误: The order by query does not have a corresponding composite index that it can be served from,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59797951/
我是一名优秀的程序员,十分优秀!