1

I have a 30GB mongodb 3.6 collection with 500k documents. the main _id field is a float timestamp (i didnt manually define an index, but inserted on the _id field, assuming from documentation that _id will be used as index and automatically maintained.

Now if I query last data I do in Python 3

cursor = cry.find().sort('_id', pymongo.DESCENDING).limit(600)
df = list(cursor)

However, just querying the last 600 records takes about 1 minute. How can this be if the index is maintained? Is there a faster way to query (like by natural order) or do I need to re-index although documentation says its done automatically?

I also tried

cursor=cry.find().skip(cry.count() - 1000)
df = list(cursor)

but this is just as slow

user670186
  • 2,588
  • 6
  • 37
  • 55

0 Answers0