Search code examples
flutterfirebasefirebase-realtime-databasefirebase-security

Are there any costs associated with adding an "indexOn" to Firebase Realtime Database security rules?


My team has three large Realtime Database shards, each one is several TB. We would like to add an index so that queries can be ordered by timestamp. Before adding the index this warning is displayed:

[FirebaseDatabase] Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "timestamp" at {path} to your security rules for better performance

While this documentation recommends adding indexes before launching, it doesn't go into detail on the impact of adding indexes to an existing database.

Does it incur a cost or slow down the database? Would it put additional load on the database? Or are there any other problems we could run into from adding an index for a large amount of data in Realtime Database?


Solution

  • firebaser here

    There is no cost associated with adding a server-side index (with .indexOn) to Firebase Realtime Database.

    Any and all costs for the product are listed on the Firebase pricing page, which for the Realtime Database shows that there is only a cost for GB stored and GB downloaded.