索引Cosmos DB不会提高性能 [英] Indexing Cosmos DB does not improve performance

查看:163
本文介绍了索引Cosmos DB不会提高性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个庞大的Cosmos DB Collection.它有大约500K记录,我的RU范围是1000RU/s.我已经为我的自定义列创建了列索引.以下是Index JSON模式.

{
    "indexingMode":"consistent",
    自动":true,
    "includedPaths":[
      {
        路径":"/Column1/?",
        索引":[
          {
            种类":"Range",
            "dataType":"String",
            精度":-1
          }
        ]
      },
      {
        路径":"/Column2/?",
        索引":[
          {
            种类":"Range",
            "dataType":"String",
            精度":-1
          }
        ]
      }
    ],
    "excludedPaths":[
      {
        路径":"/Column4/*"
      }
    ]
}


下面是我的收藏结构.

{
"Column1":"Data1",
"Column2":"Data2",
"Column3":"Data3",
"Column4":"Data4"
}


当我触发以下选择查询时("SELECT * FROM r where INDEX_OF(r.Column2,'Data2')>-1),它将返回正确的值.但是它批量执行,而不是从Indexes获取值.例如,查询应仅返回 一条记录.但是它会返回空白,并带有连续令牌.我希望索引应该从现有索引中返回记录.我错过了什么吗?

Hi All,

I have a huge Cosmos DB Collection. It has about 500K records and my RU range is 1000RU/s. I have created a column index for my custom columns. Below is the Index JSON schema. 

{
    "indexingMode": "consistent",
    "automatic": true,
    "includedPaths": [
      {
        "path": "/Column1/?",
        "indexes": [
          {
            "kind": "Range",
            "dataType": "String",
            "precision": -1
          }
        ]
      },
      {
        "path": "/Column2/?",
        "indexes": [
          {
            "kind": "Range",
            "dataType": "String",
            "precision": -1
          }
        ]
      }
    ],
    "excludedPaths": [
      {
        "path":"/Column4/*"
      }
    ]
}


And below is my collection structure.

{
"Column1": "Data1",
"Column2": "Data2",
"Column3": "Data3",
"Column4": "Data4"
}


When i trigger the following select query ("SELECT * FROM r where INDEX_OF(r.Column2,'Data2')>-1"), it returns the correct values. But it executes it in a batch instead of getting the values from Indexes. For example, the query should return only one record. But it returns blank with continuation Token. I hope the indexing should returns the record from the existing index. Is there anything i have missed? 

推荐答案

您好,Naveen,

Hi Naveen,

您是否正在使用SQL API?我将在此处提供一些涵盖Cosmos DB Indexing主题的链接:

Are you using the SQL API? I am going to provide some links here that cover the topic of Cosmos DB Indexing:

Azure Cosmos DB如何索引数据?

关于 性能调整,请查看

There is a section on Performance Tuning and please take a look at the Next Steps section for code samples.

请让我们知道您还有其他问题.问候,迈克

Please let us know what additional questions you have. Regards, Mike



这篇关于索引Cosmos DB不会提高性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆