GAE ndb 设计、性能和使用重复属性 [英] GAE ndb design, performance and use of repeated properties
问题描述
假设我有一个图片库,一张图片可能有 10 万以上的粉丝.哪种ndb设计更高效?
Say I have a picture gallery and a picture could potentially have 100k+ fans. Which ndb design is more efficient?
class picture(ndb.model):
fanIds = ndb.StringProperty(repeated=True)
... [other picture properties]
或
class picture(ndb.model):
... [other picture properties]
class fan(ndb.model):
pictureId = StringProperty()
fanId = StringProperty()
可以添加到 ndb 重复属性的项目数量是否有任何限制,在重复属性中存储大量项目是否会影响性能?如果使用重复属性效率较低,那么它们的预期用途是什么?
Is there any limit on the number of items you can add to an ndb repeated property and is there any performance hit with storing a large amount of items in a repeated property? If it is less efficient to use repeated properties, what is their intended use?
推荐答案
如果您有超过 100-1000 个值,请不要使用重复的属性.(1000 可能已经在推动它了.)它们不是为这种用途而设计的.
Do not use repeated properties if you have more than 100-1000 values. (1000 is probably already pushing it.) They weren't designed for such use.
这篇关于GAE ndb 设计、性能和使用重复属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!