简体   繁体   English

Google Cloud Datastore索引

[英]Google Cloud Datastore indexes

We are using Google App Engine for our new app. 我们正在为新应用程序使用Google App Engine。 We want to use Google's Datastore we are trying to understand how Datastore indexes work. 我们想使用Google的数据存储区,试图了解数据存储区索引的工作方式。

We understood that there are a couple of limits on indexes. 我们知道索引有两个限制。 We are especially focusing on entity index limitations. 我们特别关注实体索引限制。

We have embedded property in one of our models , 我们在其中一种模型中嵌入了属性,

Main class

Contact
{
  @Indexed
  private String name;

  @Embedded
  @Indexed
  private CStatus cstatus;
}

Embedded class   

CStatus
{
   private Long start_time = 0L;

   public enum Status
   {
      ACTIVE, PAUSE, DELETED
   };

   private String status = null;
}

Assume that I saved an instance of Contact, 假设我保存了一个Contact实例,

1.How many predefined indexes will be created for the Contact kind in total? 1.总共将为Contact种类创建多少个预定义索引?

2.How many index entries will be created in total? 2.总共将创建多少个索引条目?

3.Is there any developers' play ground available for Datastore? 3.Datastore是否有开发人员可以使用的场地? We have checked Datastore statistics but it's taking 24-48 hours to update the index entries list. 我们已经检查了数据存储区统计信息,但需要24-48小时才能更新索引条目列表。

According to your code, two simple indexes will be created; 根据您的代码,将创建两个简单的索引。 1 for name and another for status . 1个代表name ,另一个代表status

You should note that indexes will also be created if some other place in the code you run a query that requires other indexes. 您应该注意,如果您在运行查询的代码中的其他位置需要其他索引,也会创建索引。

Another thing to take note of is that the 200-limit on indexes does not apply to indexes using one single attribute. 要注意的另一件事是,索引的200个限制不适用于使用一个单一属性的索引。 It applies to composite indexes using multiple attributes. 它适用于使用多个属性的复合索引。

As of yet there is no play ground that I know of unless you wanna create a dummy project and test your code on it. 到目前为止,除非您想创建一个虚拟项目并在其上测试您的代码,否则我所知道的没有任何基础。 Otherwise you just have to play in your development environment until Google addresses that issue. 否则,您只需要在开发环境中工作,直到Google解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM