David Haddad
David Haddad

Reputation: 3926

Can we have a Model with a lot of properties (say 30) while avoiding the exploding indexes pitfall?

I was thinking that maybe you can have the index.yaml only specify certain indexes (not all the possible ones that GAE automatically does for you).

If that's not a good idea, what is another way of dealing with storing large amount of properties other than storing extra properties as a serialized object in a blob property.

Upvotes: 0

Views: 89

Answers (2)

Peter Knego
Peter Knego

Reputation: 80340

A few notes:

  1. Exploding indexes happen when you have multiple properties that contain "multiple values", i.e. an entity with MULTIPLE list properties AND those properties are listed in a composite index. In this case index entry is created for each list property value combination. In different words: index entries created equals a product of list properties size. So a list property with 20 entries and another list property with 30 entries would create, when BOTH listed in index.yaml under one compound index, 600 index entries.

  2. Exploding indexes do not happen for simple (non-list) properties, or if there is only one list property in entity.

  3. Exploding indexes also do not happen if you do not create a compound index in your index.yaml file, listing at least two list properties in same index.

  4. If you have a lot of properties and you do not need to query upon them, than you can simply put them in a list or two parallel lists (to simulate map), or serialize them. The simplest would be two two parallel lists: this is done automatically for you if you use objectify with embedded classes.

Upvotes: 2

proppy
proppy

Reputation: 10504

The new improved query planner should generate optimized index definitions.

Note that you can set a property as unindexed by using indexed=False in python or Entity.setUnindexedProperty in Java.

Upvotes: 4

Related Questions