Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 祖先索引是否占用更少的存储空间?它会消耗多少存储空间?_Python_Google App Engine_Google Cloud Datastore_App Engine Ndb - Fatal编程技术网

Python 祖先索引是否占用更少的存储空间?它会消耗多少存储空间?

Python 祖先索引是否占用更少的存储空间?它会消耗多少存储空间?,python,google-app-engine,google-cloud-datastore,app-engine-ndb,Python,Google App Engine,Google Cloud Datastore,App Engine Ndb,鉴于AppEngine中的索引占用了大量存储空间,我想知道哪种设置可以为我节省更多存储空间。我有一个拥有100000多个实体的ndb模型。index.yaml中为其自动生成的索引项如下: # index.yaml indexes: - kind: MyModel properties: - name: label - name: date - kind: MyModel ancestor: yes properties: - name: label - name:

鉴于AppEngine中的索引占用了大量存储空间,我想知道哪种设置可以为我节省更多存储空间。我有一个拥有100000多个实体的ndb模型。index.yaml中为其自动生成的索引项如下:

# index.yaml
indexes:
- kind: MyModel
  properties:
  - name: label
  - name: date

- kind: MyModel
  ancestor: yes
  properties:
  - name: label
  - name: date
我想知道保留这两个索引是否不会显著影响它们使用的存储量。或者,通过删除其中一个,我是否能够节省他们消耗的大约50%的存储空间?到目前为止,我可以很容易地重构代码以使用或不使用祖先查询,因此重构代码不是问题。我只想知道哪条路可以节省更多的存储空间

如果最好删除其中一个,我应该删除哪一个可以节省更多存储空间?祖先查询的索引,还是不是


提前感谢

假设您使用自动生成的索引(index.yaml有两种模式:自动和手动),并且最初没有使用祖先,但后来更改了方案(因此自动添加了新索引),您应该删除第一个索引:

# index.yaml
- kind: MyModel
  ancestor: yes
  properties:
  - name: label
  - name: date

如果您创建和使用没有祖先的实体,那么它应该是无的,并且这个索引工作得很好。如果您担心空间/速度问题,我建议您手动控制索引。

您只需要其中一个。如果需要一致性(用于事务),则需要祖先。谢谢。我将使用
祖先:yes
保留索引,并删除另一个索引。虽然我仍然想知道索引上有
祖先:yes
会损失/节省多少内存。你准确地描述了我的情况。索引都是自动生成的,我从不使用祖先的查询开始。谢谢你的回答。我将使用@voscausa建议的
祖先:yes
保留索引,以实现强一致性,并删除另一个索引。尽管我仍然很好奇,一般来说,具有
祖先:yes
的索引和没有祖先的索引之间的大致存储差异是什么。