Data indexing
Firebase allows you to write queries using child keys. To improve your query performance, you can define an index on those keys using the .indexOn
rule. We assume that you already knew how the index works as almost all database systems support index.
Let's take an example to understand this better. Let's say that in our HelpDesk
system, we often order tickets by department key, and we are using orderbyChild()
:
{ "rules":{ "helpdesk": { "tickets":{ ".indexOn":["department"] } } } }
Similarly, if we are using orderByValue()
, we can have the following rule:
".indexOn":".value"