I'm using Google-Appengine-NDB. And I'm tried to get distinct values from database but it's not working.
Now my code is: query_set = cls.query().order(cls.ls) # Getting ordered queries. set_of_field = set([data.field for data in query_set]) # And using this loop for differ.`
But the loop is taking too long time (over 12 sec). Please help me, how can I speed up, or how to get distinct values from ndb?
Try the distinct query, if your field is indexed you can use this: https://developers.google.com/appengine/docs/python/ndb/queries#projection
But if you have a huge list you can either do this in a taskqueue and store the results somewhere or just keep a distinct data in another model.