I have a Firestore project where my collection feed
has a timestamp field createdDate
. As I am querying the feeds based on the created time with other fields, I have created a Composite Index
including the timestamp field.
In the Indexing best practices document the following is mentioned.
If you index a field that increases or decreases sequentially between documents in a collection, like a timestamp, then the maximum write rate to the collection is 500 writes per second. If you don't query based on the field with sequential values, you can exempt the field from indexing to bypass this limit.
As I am already using the timestamp field in a Composite Index
, I can exempt the field from Automatic Index Settings
. Will this bypass this limit of 500 writes per second in the collection or it will still be applied as the Composite Index
is using the field. Please help me understand this.
The limit comes from the existence of hotspots in any index in the collection. While Firestore can update all indexes in parallel, its throughput is limited by the slowest index. Removing the hotspot from one index, but leaving it on another, means there is no increase in write throughput for the collection.
Note that this is not a hard-coded limit, but it comes from the physical limitations of having to update clustered files across multiple data centers.