It sort of looks like:  "The built-in indices are not efficient enough
for this query and your data."

When there is no compiste index for a multiple property query, the
'merge join' strategy will be used.  I would guess you don't have a
composite index defined on those two fields, but there are a lot of
non-matching records that match one of the two criteria.  You can
search the groups for an explanation of 'merge join,' or watch Brett
Slatkin's Scalable Complex Apps on App Engine talk.

You need to add the index:
- kind: Country
  properties:
  - name: country_code
  - name: government_tax



Robert







On Tue, Feb 22, 2011 at 11:09, Jairo Vasquez <jairo.vasq...@gmail.com> wrote:
> Hi,
> I'm facing this situation and I don't know why is it happening:
> I do a query
> cs = Country.all().filter('government_tax =', 0.005).filter('country_code
> =', 'US').fetch(1000)
> and it works :)
> ... now I do it again but I change 0.005 to 0.5 and not if FAILS!!!
> cs = Country.all().filter('government_tax =', 0.5).filter('country_code =',
> 'US').fetch(1000)
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (135, 0))
> ---------------------------------------------------------------------------
> NeedIndexError                            Traceback (most recent call last)
> /Users/test/countries/<ipython console> in <module>()
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.pyc
> in fetch(self, limit, offset, **kwargs)
>    1831
>    1832     raw_query = self._get_query()
> -> 1833     raw = raw_query.Get(limit, offset, config=config)
>    1834
>    1835     if self._compile:
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.pyc
> in Get(self, limit, offset, **kwargs)
>    1350       batch = batcher.next_batch(_MAX_INT_32)
>    1351     else:
> -> 1352       batch = batcher.next_batch(limit)
>    1353     self.__cursor_source = lambda: batch.end_cursor
>    1354     self.__compiled_query_source = lambda: batch._compiled_query
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_query.pyc
> in next_batch(self, min_batch_size)
>    1103       raise StopIteration
>    1104
> -> 1105     batch = self.__next_batch.get_result()
>    1106     self.__next_batch = None
>    1107     self.__skipped_results += batch.skipped_results
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.pyc
> in get_result(self)
>     532       return None
>     533     else:
> --> 534       return self.__get_result_hook(self)
>     535
>     536   @classmethod
> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_query.pyc
> in __query_result_hook(self, rpc)
>    1017
> *datastore_index.CompositeIndexForQuery(rpc.request)[1:-1])
>    1018         raise datastore_errors.NeedIndexError(
> -> 1019             str(exc) + '\nThis query needs this index:\n' + yaml)
>    1020       raise
>    1021
> NeedIndexError: The built-in indices are not efficient enough for this query
> and your data. Please add a composite index for this query.
> This query needs this index:
> - kind: Country
>   properties:
>   - name: country_code
>   - name: government_tax
> Is this razonable?
> Anybody can explain me what happens?
> Thanks a lot
> --
> Jairo Vasquez
> Paymentez
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to