Heatmap patterns

This page shows examples of patterns that you might see in a Key Visualizerheat map. These patterns can help you to troubleshoot specific performanceissues.

Some issues that are exposed in Key Visualizer relate to your primary keydefinition. Because a primary key is immutable, these issues are best discoveredduring the design, or proof of concept, stage.

Other issues may relate to your instance's node allocation. You may need toprovision additional capacity, either overall or possibly at certain times ofday. To change the number of nodes associated with your instance, seeChanging the number of nodes.

Before you read this page, you should be familiar with theoverview of Key Visualizer.

Evenly distributed reads and writes

Example heatmap showing evenly distributed areas of hot and cold

If a heatmap shows a fine-grained mix of dark and bright colors, then reads andwrites are evenly distributed throughout the database. This heatmap representsan effective usage pattern for Spanner, so you do not need to takeany action.

Your own heatmap may not be as evenly distributed as this but still illustratea healthy schema and workload. Some number of hotspots can be expected in aproperly resourced configuration.

Monotonically increasing keys

Example heatmap showing a diagonal (falling from left to right) hot band

A heatmap with a single bright diagonal line, or a triangle with a flat top,can indicate a database that uses sequential keys. Sequential keys are ananti-pattern in Spanner; see theSchema design best practices page for whysequential keys cause hotspots.

Persistently hot key ranges

Example heatmap showing multiple hot horizontal bands

If a heatmap shows horizontal bands of bright color, separated by dark colors,it indicates that specific row ranges are consistently being more heavilyaccessed over time.

To address this issue, consider changing your schema design or your applicationso that the data in a heavily used row, or in an excessively large row, isspread across multiple rows.

Single hot table

Example heatmap showing a single hot horizontal band

If a heatmap shows a band of bright color in a single table, itindicates heavy access of that table over time.

This pattern by itself is not necessarily problematic. If you're seeing thispattern in combination with performance issues, you'relikely running out of compute capacity. Some things to consider:

  • Your application may be requesting a full table scan, which will show inKey Visualizer as a bright band of the whole table. Instead, considera more restrictive query, or query against the index to reduce the number ofrows being scanned.

  • Increase the number of nodes for this instance.

Roving reads and writes over times

Example heatmap showing diagonal (rising from left to right) hot bands

A heatmap showing multiple diagonal bright lines (rising or falling)usually indicates sequential reads or writes to rows in a short period of time.

If the lines correspond with read activity, such as a table export, no action isrequired. If you're experiencing performance issues during these reads, considerincreasing the number of nodes for your instance during thesetime periods. You can decrease the node number between periods.

If the lines correspond with write activity, and you're experiencing performanceissues, you should consider changing your workload to a random write instead ofa sequential write.

Sudden traffic increase

Example heatmap showing two hot horizontal bands that begin halfway across the heatmap

A heatmap showing bright horizontal bands that appear partway across the heatmapindicate a sudden change in the usage pattern of a database. This can be a roguequery or an unexpected surge in activity for certain rows.

Caveats

There are some scenarios where Key Visualizer may not present a complete pictureof performance and resource usage.

ScenarioWhat the heatmap shows
A large data table and a few small tablesKey visualizer selects more row ranges in large tables than smaller tables. As a result, a small table may only appear as a single row range on the heatmap. There will be a row range representing every table as long as the number of tables is less than 1,000. When a key or a small range of keys are hot in a small table, the user may only know that this table is hot, but not any further.
Many tables / indexes
For example, a database with hundreds or over a thousand tables, regardless of size.
Key visualizer selects at most 1,000 row ranges. When there are many tables and indexes, some of them may only have zero or one data point on the heatmap. Therefore, hotspots may be missing due to its table being skipped or downsampled.
Rapidly changing keysRapid changes in the key space will result in frequent changes in row ranges. When a previous row range has to be split, due to newly inserted keys, or multiple row ranges are merged, due to deleted keys, the metrics will be approximated (e.g. divided/combined). Compounded approximation of metrics values will likely make them less accurate. In addition, there is a delay in updating row ranges after changes in the key space, which can result in a loss of granularity until row ranges are updated.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.