Improving performance on the logbook (or at least understanding it)
Getting the events from the beamline or ESRF logbook took ~7 seconds. I'd expect much faster as the fields are indexed:
const [total, events] = await Promise.all([this.count(find), Event.find(find).populate("tag").sort(sort).skip(skip).limit(limit).lean()]);
The explain returns (and seems find to me):
{
queryPlanner: {
plannerVersion: 1,
namespace: 'icatplus.events',
indexFilterSet: false,
parsedQuery: { '$or': [Array] },
winningPlan: { stage: 'SUBPLAN', inputStage: [Object] },
rejectedPlans: []
},
executionStats: {
executionSuccess: true,
nReturned: 100,
executionTimeMillis: 2,
totalKeysExamined: 100,
totalDocsExamined: 100,
executionStages: {
stage: 'SUBPLAN',
nReturned: 100,
executionTimeMillisEstimate: 0,
works: 101,
advanced: 100,
needTime: 0,
needYield: 0,
saveState: 0,
restoreState: 0,
isEOF: 1,
inputStage: [Object]
},
allPlansExecution: []
},
serverInfo: {
host: 'icat-database',
port: 27017,
version: '4.4.10',
gitVersion: '58971da1ef93435a9f62bf4708a81713def6e88c'
},
ok: 1
}
Edited by Alejandro De Maria Antolinos