views:

45

answers:

1

This is a general App Engine data store indexing question. The data store automatically build indexes that can be used for simple single property queries (queries that do not involve composite keys).

Does the overhead in generating this index vary on the underlying data type of the entity's property ?

Essentially my question boils down to:

def Person(db.Model):
  name = db.StringProperty()
  rollnumber = db.IntegerProperty()

Is the indexing overhead with respect to the property rollnumber lesser when compared to that of name?

+4  A: 

The space required to index a value is comprised of:

  • The size of the value itself,
  • If it's variable length, like a string, anywhere from 1 to 3 bytes to store the length of the value
  • The size of the name (eg, 'rollnumber'), plus, again, a few bytes to store the length
  • The size of the entity's key
  • A few extra bytes of overhead

The only surprising thing here should be that the name is stored with every indexed property. This is because there are no statically defined column names - no schema - in the datastore, so it's necessary to store it with every indexed value.

Nick Johnson
Is there any difference in the querying aspect i.e. does query performance depend on the property's data type ? From your answer, I would imagine not - but i just wanted to make sure.
Rahul
No, there shouldn't be a significant difference filtering on different data types, unless you're talking about filtering on a very long string, for example.
Nick Johnson