indexes on listproperty

7 views
Skip to first unread message

Alan

unread,
Jun 10, 2008, 11:10:28 AM6/10/08
to Google App Engine
Does anybody have insight on how indexes on ListProperty work?

I have an attribute called indexable_list that is a db.ListProperty
type

If my GQL does something like:

WHERE indexable_list = 'FOO' and indexable_list = 'BAR' then the
dev_appserver will create an index of:

- kind: model
properties:
- name: indexable_list
- name: indexable_list
- name: name


"name" is another property in the model that was not used in the
query.

Does this create an index entry for all combinations of the items in
the List? My guess is yes - especially since this quickly hits the new
5000 limit on index properties.

If it does do this, then I'm having trouble reconciling the following
effect (for certain data distributions):

SELECT * FROM model WHERE indexable_list = 'FOO' LIMIT 30
- works

SELECT * FROM model WHERE indexable_list = 'BAR' LIMIT 30
- works

SELECT * FROM model WHERE indexable_list = 'FOO' AND indexable_list =
'BAR' LIMIT 30
- gets an exception based on resources. eg is this using the
index?? This only happens for certain data distributions.

Mahmoud

unread,
Jun 10, 2008, 11:41:50 AM6/10/08
to Google App Engine
See this thread:
http://groups.google.com/group/google-appengine/browse_thread/thread/d5f4dcb7d00ed4c6#

I believe you're right; the engine does create an index entry for all
combinations of the list items.

ryan

unread,
Jun 10, 2008, 12:39:59 PM6/10/08
to Google App Engine
On Jun 10, 8:41 am, Mahmoud <mahmoud.ar...@gmail.com> wrote:
> I believe you're right; the engine does create an index entry for all
> combinations of the list items.

It does for some queries, but not all. Some queries can be satisfied
by the built-in indexes, ie without a dedicated index in index.yaml.
This includes queries with only = filters and no sort orders, like
Alan's three example queries.

Alan, as you mentioned, your index includes a second property, name,
at the end. That index was probably generated for a query that had two
= filters on indexable_list and a sort order on name.
Message has been deleted
Message has been deleted

Alan

unread,
Jun 10, 2008, 5:46:19 PM6/10/08
to Google App Engine
> Alan, as you mentioned, your index includes a second property, name,
> at the end. That index was probably generated for a query that had two
> filters on indexable_list and a sort order on name.

"name" does not appear anywhere in my query. If I try to create the
index without the "name", get the following error when uploading the
app to the server.

Error 400: --- begin server output ---
Creating a composite index failed: An index may not be comprised of a
single repeated property. Your query probably doesn't need this index.
Try without it!
--- end server output ---

Reply all
Reply to author
Forward
0 new messages