Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore single-field index exemption limit

Why does Firestore have a (seemingly small) limit of 200 on single-field index exemptions?

If anything, allowing more would only help reduce costs for the user and for Google, wouldn't it?

like image 473
user1056585 Avatar asked Oct 27 '25 07:10

user1056585


1 Answers

We need to hold that information in memory of every process that could handle a write to your database, and compare the incoming write to this list of exemptions. This creates a need for both memory management and latency impact.

There are techniques to make it easier to create least exemptions (and less configuration effort for you!). For example, Maps/Objects let you create your own defaults pretty easily.

For example, add a single exemption for a field called for arguments sake _auto_off_, and set all indexes off. Use the field as a map and now every new field in that map will be not indexed without needing an exemption for that new field.

If you decide you do need to query against a field in this map, you can create an exemption for that field in the map explicitly, such as _auto_of_.ranking.

Screenshot of Single Field Indexing page showing the settings for both the map and the map's sub-field

like image 195
Dan McGrath Avatar answered Oct 28 '25 20:10

Dan McGrath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!