Since years of using relational databases, I have been trying to develop a fairly simple chat / messaging application using FireBase
FireBase uses the NoSQL data structure approach using formatted JSON strings.
I did a lot of research to understand how to structure a database based on performance. I tried to “denormalize” the structure and got the following:
{ "chats" : { "1" : { "10" : { "conversationId" : "x123332" }, "17": { "conversationId" : "x124442" } } }, "conversations" : { "x123332" : { "message1" : { "time" : 12344556, "text" : "hello, how are you?", "userId" : 10 }, "message2" : { "time" : 12344560, "text" : "Good", "userId" : 1 } } } }
The numbers 1, 10, 17 are examples of user identifiers.
My question is, can this be better structured? The goal is to scale up as application users grow and still get the best performance.
source share