3 questions about appengine indexes

I got the following situation

class M(db.Model):

    a = db.ReferenceProperty(A)

    x = db.ReferenceProperty(X)
    y = db.ReferenceProperty(Y)
    z = db.ReferenceProperty(Z)

    items = db.StringListProperty()

    date = db.DateTimeProperty()

I want to make queries that filter (a), (x, y or z) and (elements) ordered by date ie

mm = M.all().filter('a =', a1).filter('x =', x1).filter('items =', i).order('-date')

For example, there will never be a query with a filter on x and y, for example.

So my questions are:

1) How many (and which) indexes should I create?

2) How many lines can be added to elements? (I'd like to add in the thousands)

3) How many index entries will I have on one "M", if there are 1000 elements?

I don't understand this index stuff yet and are killing me. Your help will be greatly appreciated :)

+3
source share
3 answers
  • , , : a,x,items,-date, a,y,items,-date, a,z,items,-date. , list .

  • total 5000 . , 5000/3 = 1666 ( 1000 ).

  • 3 * 1000 = 3000.

.. , (= unindexed). 2N, N (2 asc, desc). 2 * (5 + no_items), items - , .

+1

/ , : https://developers.google.com/appengine/docs/python/datastore/queries#Big_Entities_and_Exploding_Indexes

, , , 5000 . a, x, items (1000 items), date: | a || x || items | * | date | == 1 * 1 * 1000 * 1 == 1000.

5001 , put() .

, , x, y - , , , . 1 * 1 == 1.

, , , , . , 2 100 , 100 * 100 , , 200 ( , -).

+2

. https://developers.google.com/appengine/articles/indexselection, App Engine ( ), . , , : ( + 1) * ( ).
, , , - , .

+1

All Articles