Optimizing MongoDB Query for Unique User Count
How can I optimize my MongoDB query to count unique userIds for a specific action type (LOGIN_CLIENT) within a date range (startOfDayUTC to endOfDayUTC) without consuming too much time or resources?
4 Replies
You selected to wait for the human sages. They'll share their wisdom soon.
Grab some tea while you wait, or check out
#ask-ai
if you'd like a quick chat with the bot anyway!Hey 👋
Is your History Collection very large? How much time is it currently taking?
I see that you have already created indexes, which is good.
It have 800K data and take time from 500ms to 10000ms
i do second way of https://discord.com/channels/937751382725886062/1349713223557054476/1349713315915632694
Is it ok?
:}
Yes that approach should also work 👍