When I do a query to my database with python-cloudant using 3 selectors, the query takes ~15 seconds to complete and print results. When I put a limit of 2 in (see code below), the result appears very quickly, but after 2 takes much longer. There are currently ~190,000 documents in this database. Am I missing something that can speed this up?
query = cloudant.query.Query(db,selector={'_id': {'$gt': 0},'userid':{'$eq':'56900'},'year':{'$eq':'[2011]'}},fields=['_id','userid','year'],sort=['_id'],limit=2)
for doc in query()['docs']:
print doc
(The goal of this query is to get all records from the userid "56900" that contain "[2011]" in the year field and sort them by the _id)
'_id': {'$gt': 0}from your query, iirc that would trigger a full scan since your looking at the _id field, which all docs have - rhyshort