[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Get started with Key Visualizer\n===============================\n\nThis page describes how to use Key Visualizer to check for performance issues\nthat are related to your Firestore usage patterns.\n\nBefore you begin\n----------------\n\nTo use Key Visualizer for Firestore, you must enable the\nFirestore Key Visualizer API.\n\n\n[Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=firestorekeyvisualizer.googleapis.com&redirect=https://console.cloud.google.com)\n\n### Required roles\n\nMake sure that your account is granted one of the following IAM\nroles:\n\n- Cloud Datastore Owner\n- Cloud Datastore Key Visualizer Viewer\n- Editor\n- Owner\n\nThese roles include the following IAM permissions which are\nrequired to access Key Visualizer:\n\n- `datastore.keyVisualizerScans.get`\n- `datastore.keyVisualizerScans.list`\n- `datastore.databases.getMetadata`\n- `resourcemanager.projects.get`\n\nYou can also define a [custom role](/iam/docs/creating-custom-roles) with the\nrequired permissions.\n\nViewing a scan for a time period\n--------------------------------\n\n\nEach Key Visualizer scan covers a two hour period. A scan for a given period\nis available for databases with traffic that exceeds 3000 document operations\nin any given minute in that period.\n\n\u003cbr /\u003e\n\nTo launch Key Visualizer:\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 **Key Visualizer**.\n\n4. Select a time span and a metric from the available Key Visualizer scans:\n\n 1. Click the **Pencil icon** in the upper right. Select a **Date**\n and a **Time Span**.\n\n Scans are available based on [scan eligibility](./key-visualizer#scan_eligibility).\n You can't select time spans that did not meet scan eligibility or that are\n still processing. The two most recent scans of the day will take some\n time to process before they are available.\n 2. Select **All document data** or **All index data** as the source.\n\n 3. Click **Update**.\n\n5. Select a metric to analyze:\n\n Click the metrics dropdown in the upper left and select a metric to view. Key\n Visualizer opens in the **Ops/s** metric for document keys and **Index\n Write Ops/s** metric for index keys by default.\n\nTo compare metrics or look for data correlations, you can display\nmultiple Key Visualizer metrics together.\nSee [Finding connections between different metrics](./keyvis-exploring-heatmaps#finding-connections).\n\nViewing an activity overview\n----------------------------\n\nTo get an overview of activity during the selected two-hour time period,\nreview the heatmap for the default metric.\n\nThe following example shows a heatmap where there are major differences in the\nusage pattern for different key ranges:\n\n- Ranges shown in dark colors have little or no activity.\n- Ranges in bright colors have significantly more activity.\n- The glowing white range in the middle has very high activity.\n\n### Document keys scan\n\nThe **Ops/s** metric measures the number of requests per second for each key\nrange. This metric is a sum of write, lookup, and query requests. Key Visualizer\nshows this metric by default when you open a heatmap.\n\nAfter getting an idea of the overall activity in your database,\nyou can continue your investigation by looking at other metrics and\nfocusing on key ranges that might be causing problems. [Learn\nmore](./keyvis-exploring-heatmaps).\n\n### Index keys scan\n\nThe **Index Write Ops/s** metric at a given cell measures the average index writes per second\nwithin the corresponding 10-second time interval and key range.\n\nWhat's next\n-----------\n\n- Learn to recognize [common patterns in heatmaps for document keys](./keyvis-patterns).\n- Learn to recognize [common patterns in heatmaps for index keys](/firestore/docs/keyvis-patterns-index).\n- Find out how to [explore a heatmap in depth](./keyvis-exploring-heatmaps)."]]