I have a time series collection that contains nearly one billion data.
I simply running:
db.cllection.find({'metaData.eventId': "FB-2348", 'metaData.marketName': "Match Odds", 'metaData.selectionId': 0})
The query cost more than 2mins to finish
"executionStats":{
"executionSuccess":true,
"nReturned":10,
"executionTimeMillis":207968,
"totalKeysExamined":0,
"totalDocsExamined":5032348,
"executionStages":{
"stage":"COLLSCAN",
"filter":{
"$and":[
{
"meta.eventId":{
"$eq":"FB-2348"
}
},
{
"meta.marketName":{
"$eq":"Match Odds"
}
},
{
"meta.selectionId":{
"$eq":0
}
}
]
},
"nReturned":10,
"executionTimeMillisEstimate":200392,
"works":5032349,
"advanced":10,
"needTime":5032338,
"needYield":0,
"saveState":13268,
"restoreState":13268,
"isEOF":1,
"direction":"forward",
"docsExamined":5032348
},
I have billion data looks like this:
{
ts: 2024-04-05T07:50:53.111+00:00
metaData: {
betType: "for,ahover,18",
bookie: "pin88",
eventId:"2024-04-07,1514,1154",
inRunning:false,
sport:"FB"
},
min:null,
price:5.03,
max:118.6643
}
Is there anything wrong with my query? Or is there anything I can optimize in my collection/schema design/data configuration? Thank you.