Indexing
A database index helps connect items to their locations. It is used to improve the speed of search in queries. If the index does not exist, databases typically search for items one by one. But Firestore supports high-performance queries by indexing all your queries, which means the following:
- Indexes for your basic queries are all automatically created for you
- Query performance is dependent on query results and not on the record volume in the database
- There are the two types of indexes:
- A single-field index is an ordered mapping of all the documents in a collection consisting of a specific field
- A composite index is also an ordered mapping of documents, but it is based on an ordered list of fields to index (basically field-combinations as opposed to one specific field)
- A collection group query refers to the hierarchy of collections, documents, subcollections, and so on, and querying such collection groups is possible through collection group indexes