Search code examples
mongodbperformancescalingdatabase

Can creating table per synchronous chat instant be wrong idea


I am developing a chat kind of web app to experiment live group edit. My idea, is something like wave, where you can edit even those you have already send. I was planning to use mongodb or something similar for per chat basis.

My reason for that is: Say there are 100 texts in one instants of chat. And we have 10 such chats. What happens is there will 1000 chats in the table in which its store. So even a person in one chat edit his chat, the db has to look through all 1000. So if I use table per chat, i felt it could improve speed and performance.

But I want to know from people who have done this before.


Solution

  • There are at least 2 obvious issues with the approach (not going to the schema design)

    1. you can't have unlimited no of namespace (I am not sure how big is your use case) Check this : http://docs.mongodb.org/manual/reference/limits/#namespaces
    2. The write lock is per db, so if you make multiple tables/collections, it won't optimize on insertion