Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6841869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:01:14+00:00 2026-05-27T00:01:14+00:00

I have a collection in MongoDB with 20 million documents and an index created

  • 0

I have a collection in MongoDB with 20 million documents and an index created for the collection. I have confirmed that the find() query uses the index (col_1_col_2) (confirmed using the explain). However, I’ve noticed that the very first find() query in a day takes 5-10 sec, but all subsequent queries take less than 100 ms.

Updated DB stats:
db..stats()
ns .
count 20135438
size 5694.57m
avgObjSize 296.55146314672
storageSize 7109.57m
numExtents 35
nindexes 4
lastExtentSize 1188.86m
paddingFactor 1
flags 1
totalIndexSize 3044.69m
indexSizes {
“id“: 653319632,
“col_1_col_2”: 691730480,
“col2_1”: 848832320,
“col1_1”: 998706576
}
ok 1
{top:1}
total 18
readLock 16

Questions:
1 Why does the first query take longer time?
2 Is this to do with loading the index in RAM?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:01:15+00:00Added an answer on May 27, 2026 at 12:01 am

    check the disk activity during this first request. It could be related to mounting data from disk to RAM.

    If you use linux : iostat -m 1 will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's assume that I have a collection in mongodb, where all of its documents
I have mongodb running and using morphia. Having a Collection of BatchData Documents and
I have a large collection (~2.7 million documents) in mongodb, and there are a
Im using the npm mongodb driver with node. I have collection.findOne({query}, function(err, result) {
I am beginning with mongodb and have a collection with documents that look like
I have a Mongodb collection and I have created a Python class for documents
i have a mongoDB collection named col that has documents that look like this
I have a MongoDB collection with data that was not saved through my Derby
I have simple MongoDB collection and I am using SLIM micro-framework to develop a
I have a collection of articles in MongoDB that has the following structure: {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.