Reputation: 1837
I have an application that uses Firebase Firestore. This is a great platform and my application grows every day, as well as my indexes. However, I suspect that they have unnecessary indexes. But I don't know how to identify them.
Is there a way to find this out in the Firestore?
Upvotes: 18
Views: 1457
Reputation: 1
Maybe this helps:
firebase firestore indexes list
firebase firestore indexes delete <index-name>
Upvotes: -5
Reputation: 4795
I'm not aware of an automated solution to identify unused indexes, but you only need an index for fields that are explicitly used in your queries (e.g. for sorting).
I'd manually delete indexes that you suspect aren't used. If you happen to delete one that's actually needed then you'll know immediately because Firestore will simply error when you make the query. The error message should contain a link to set up the required index.
https://firebase.google.com/docs/firestore/query-data/indexing
As you use and test your app, Cloud Firestore generates error messages that help you create additional indexes your app requires.
Upvotes: -5