I need to store a lot of ModelA
entities, and because app engine pricing is based on the number of entities written/read, I bundle together 100 entities and store them as one ModelB
.
class ModelA(ndb.Expando):
a1 ... a20 = ndb.IntegerProperty()
class ModelB(ndb.Model):
data = ndb.StructuredProperty(ModelA, repeated=True)
I have only 80 such ModelB
entities in my datastore, that should use around 1-2MB of memory, yet ModelB.query().fetch()
takes 5 seconds. Is there any way to make this faster? Would using LocalStructuredProperty
instead of StructuredProperty
be better?
If you don't need to index the values (for queries), you might want to store them as an opaque object:
This will avoid the overhead of handling structured properties and validation.