Realtime database data structure modeling
问题 We have a chat system for which we have a analytics dashboard. currently we are showing the top said sentences. The model looks like below: messages --key1 -text: "who are you" --key2 -text: "hello" --key3 -text: "who are you" there is a database trigger that every time a new message gets inserted store a count like below stat --topPhrases --keyA --phrase: "who are you" --count: 2 --key --phrase: "hello" --count: 1 Our dashboard now queries this data and shows on dashboard as top sentences