I am very new to Firebase.We have an application which creates notifications for users.The same notification might be delivered to multiple users. So we have structured the data as follows to optimize the data storage cost:
notifications
{
message1
{
tiltle:"abc",
desc:"desc"
user1 : true
user2 : true
user3 : true
}
message2
{
tiltle:"efg",
desc:"desc"
user1 : true
user2 : true
user3 : true
}
}
the users query the messages using orderByChild("<userId>").equalTo(true)
.
We cannot use an array of users attached to messages as the user can mark the message as read in which case we need to remove the user from the message.
Now the problem is that we see the queries are slow. Further we see a warning from firebase which says us to use indexes while performing queries on child nodes. The number of users will keep increasing, which would mean we need to create an index whenever a new user signs up.
Given this situation, i was wondering if there is any limit on the number of indexes that can be created?Also what will be the impact of creating a large number of indexes?