[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Heatmap patterns for index keys\n===============================\n\nThis page shows examples of patterns that you might see in a Key Visualizer\nheatmap. These patterns can help you troubleshoot specific performance\nissues.\n\nEvenly distributed usage\n------------------------\n\nIf a heatmap shows a fine-grained mix of dark and bright colors, then write/delete operations for\nindex keys are evenly distributed throughout the database. This heatmap likely\nrepresents an effective usage pattern for Firestore. \n\nIndexes on sequential keys\n--------------------------\n\nA heatmap with a single bright diagonal line can indicate an index that is on a\nkey that is strictly increasing or decreasing, such as timestamp. Indexes on\nsequential keys are not recommended and can create hotspots. When hotspotting,\nyou might observe corresponding elevated latencies.\n\nSome examples of common hotspots on index are as follows:\n| **Note:** In the following heatmap example, for Firestore, the x-axis of the heatmap represents time, and the y-axis represents index keys.\n\n### Hotspotting due to increasing timestamp\n\nIn this example, a heatmap with a single bright diagonal line can indicate a\ndatabase that uses strictly increasing or decreasing index write/delete operations on a timestamp\nfield name. \n\n### Hotspotting due to increasing field names\n\nIn this example, a heatmap with a single bright diagonal line can indicate a\ndatabase that uses strictly increasing or decreasing index write/delete operations on an\nincremental field, such as auto-generated invoice numbers. \n\nTo identify the hotspotting issue, use the Key Visualizer tool and [understand the index key\nstructure](/firestore/docs/keyvis-patterns-index#understand_the_index_key_structure) to determine which index causes the issue and exempt those indexes\nwith [best practices](./best-practices#high_read_write_and_delete_rates_to_a_narrow_document_range).\n\nUnderstand the index key structure\n----------------------------------\n\nBefore you understand the structure of index keys that you see in Key Visualizer\ntool, learn about [indexes](./concepts/index-overview) in Firestore.\n\nThe following code shows an example index key format that you see when you hover\nover the affected key-range on the heatmap. \n\n COLLECTION: projects/PROJECT_ID/databases/(default)/documents/Users\n PROPERTIES: (Timestamp: DESC) \n VALUES: (16500000000000001)\n DOCUMENT: projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/databases/(default)/documents/Users/5000000000000001\n\nWhere:\n\n- **COLLECTION** : location of the collection in your database. Based on the [scope](./concepts/index-overview#query_scopes), it can be collection path for collection scope or collection name for collection group scope.\n- **PROPERTIES** : fields used to create the index. The [`__name__` ordering property](/firestore/docs/concepts/index-overview#default_ordering_and_the_name_field) is only shown for index definitions that modify the default ordering.\n- **VALUES**: value of each property.\n- **DOCUMENT**: ID of the document updated in an operation.\n\nFrom the earlier example, identify the fields from the **PROPERTIES**\nvalue to find the affected index.\n\nTo find the index, complete the following steps:\n\n1. In the Google Cloud console, go to the **Databases** page.\n\n [Go to Databases](https://console.cloud.google.com/firestore/databases)\n2. Select the required database from the list of databases.\n\n3. In the navigation menu, click **Indexes**.\n\n4. Go to the **Composite** or **Single Field** tab.\n\n You can identify the type of index by analyzing the **PROPERTIES** field. See\n [examples of index keys](./keyvis-patterns-index#examples_of_index_key_entries_on_the_heatmap) for more information.\n5. Click **Filter** , select **Fields**, and enter the name of the field.\n\n Use the **OR** operator to add more fields in case of composite indexes.\n\nAfter you have identified the index that is causing issues, you can use the following solutions:\n\n- Composite index: Either modify the index to ensure that the field whose value\n monotonically increases or decreases is not selected as the first field for\n indexing, or delete the index.\n\n- Single-field index: Add an exemption for the field and the sorting order that\n you want to exempt. See [Adding a single-field exemption](./concepts/index-overview#single-field_index_exemptions) for more information.\n\n### Examples of index key entries on the heatmap\n\nWhat's next\n-----------\n\n- Learn how to [get started with Key Visualizer](./keyvis-getting-started).\n- Find out how to [explore a heatmap in detail](./keyvis-exploring-heatmaps).\n- Read about the [metrics you can view in a heatmap](./key-visualizer#metrics)."]]