Hi,
We create a sample for chat service, and for all dialogue we store messages and activity in the database. Until now we put all in the same collections, but if we get lot of users, it can be consume lot of CPU / Network.
So is it better to create many collections and all users watch one of them for modification, or create an huge collection and all users watch it for modification (and filter only after) ? We read collection and watch modification on it (via realtime API) Any best practice for this case ?
Hi
You can keep using 1 collection. With proper indexes, all queries will be quick. We have seen collections with millions of documents with no performance implication. Regarding realtime, if you subscribe, you only get notifications about documents you have read permission to. So if you enable document security, and make sure to only give read permissions to those who need it, all should be fine.
Thanks for the complete answer 👍
[Solved] One huge collection or lot of small ?
Recommended threads
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...
- Appwrite for Education
I am writing to report an issue with my account limits. I currently have the GitHub Student Developer Pack active, which should include 10 Appwrite Pro projects...
- How to stop my project from being frozen...
So we encountered an error in production because our appwrite project had been frozen due to inactivity. Is there any way of automating checking in and activity