FirexportGuides
Firestore Enterprise Index Management: Just Remember This
Firestore Enterprise runs a query even when no index matches it. It scans the whole collection and bills you for what it scanned. So a missing index shows up only as cost and latency, with no error, and it doesn’t show at all while you develop with a few documents. Leave writing indexes for your queries to an AI agent. Your part is to find what it missed in the two ways below and hand that back.
Reads are billed one unit per 4 KiB read, so without an index the bill follows the size of the collection. A query that finds one 2 KiB document among 100,000 costs 2 units with an index and 50,000 without one (query pricing examples).
Updated November 20, 2026. Firexport, the extension this guide mentions, is ours. You can do the same without it.
The short answer
- When a query is slow or expensive: Hand it to the AI and have it find the cause with Query Explain and fix it. 1. Query Explain
- To find problem queries early: Export Query Insights data and hand it to the AI to improve. 2. Query Insights
1. Have the AI fix slow or expensive queries with Query Explain
An AI agent runs Query Explain itself with a server client library, so all you tell it is which query is slow or expensive (Query Explain, Optimize query performance).
If you want to look yourself, run the same conditions in the Query editor on the console’s Firestore Data tab and open the Query Explain tab. A TableScan at the bottom of the execution tree means it scanned everything without an index. The console actually runs the query, so you pay what the query costs. With Firexport, you see the result as a card of read units, latency and the execution tree (free).
2. Export Query Insights so the AI finds problem queries early
Query Explain looks only at the query you pick, but the Query Insights tab of the console’s Firestore page groups the queries that actually run by shape and shows, for up to 30 days, how often each ran and its average results returned, documents scanned and index entries scanned (Query Insights). The AI picks the queries that scan far more than they return and adds the indexes they need.
Query Insights has no documented API, so an agent can’t read it itself: the check starts when a person hands the data over. Copying the console’s table works too.
Firexport adds an Export button right of the Query Insights date range that saves the top 100 queries as CSV or JSON. It reads nothing from your database and is free. With Advanced, the file has the unrounded numbers and a sample of each query. Use it to keep the data past 30 days, to compare before and after an index change, or to hand it to an AI agent.
Export Query Insights to CSV or JSON and hand it to your AI agent.
Query Insights also shows index recommendations. Open one from the query’s row and save it, and the index is created in the database right away. Recommendations come periodically from past queries and only propose new composite indexes. They never suggest changing or deleting an index you have.
Query Insights shows you something only when someone opens it. Set one Cloud Monitoring alerting policy so that a sudden rise in scanning reaches you, on billed read units (firestore.googleapis.com/api/billable_read_units) or on documents scanned per query (firestore.googleapis.com/query_stat/per_query/scanned_documents_counts) (metrics list). You can ask the AI to create the alerting policy too.
FAQ
What happens when you query Firestore Enterprise without an index?
The query runs without an error. It scans the whole collection (a TableScan), you are billed read units for the bytes it scanned, and sorting happens in memory, where a query is limited to 128 MiB.
Does Firestore Enterprise create single-field indexes automatically?
No. It creates no indexes at all. Even a query with a single orderBy needs an index of its own to avoid a scan.
How do I check whether a query uses an index?
Look at the bottom node of the execution tree in Query Explain. A TableScan means no index was used; when an index is used, the node shows its ID and fields.
Are Query Insights index recommendations applied automatically?
No. An index is created only when you open the recommendation and save it.
Sources
Checked on 2026-11-20. The Enterprise pages were all last updated on 2026-11-18.
- Index overview: no automatic indexes
- Query Explain, Optimize query performance: the execution tree, TableScan
- Query Insights: its columns, 30-day retention, index recommendations and their limits
- Pricing examples, query pricing examples, quotas: read units, Query Explain’s cost, 128 MiB
- Cloud Monitoring metrics:
billable_read_units,scanned_documents_counts - Firexport’s measurement (2026-09-24): the console’s query editor always runs in analyze mode
