A new query experience for Cloud Spanner: editor, query plan, and more
Elissa Lerner
Senior UX Writer
We’re excited to launch a round of significant advances to Cloud Spanner’s query experience. With the recent improvements to our SQL features and query optimization, it was only natural to turn to the query page itself and bring more capabilities to the fore. These updates mark a turning point in Spanner’s commitment to ease-of-use for our customers.
The first set of changes you’ll notice is in the query editor. Aside from cosmetic changes, we’ve significantly improved our autocomplete feature, as well as added a prevalidation check for your query. Both of these can help ensure that you’ve set up your query for success prior to running it. There’s also a formatting option, as well as the ability to choose “Run selected” for a portion of your query.
But the major upgrades have arrived in the query explanation tab. We often hear from customers the desire to better understand how their query is executing, which is especially helpful for troubleshooting slow and underperforming queries. The new query plan visualizer now offers an interactive map of the operators at work in your query, illustrating how Spanner is directing the various parts of your query to execute. We’ve integrated definitions of these operators into the UI, bringing the documentation resources closer to you in your investigation.
A few of our favorite aspects of the new query explanation:
Each operator node card displays the rows returns, latency, and CPU time per operator, so you can quickly scan the query’s general behavior. We also highlight noteworthy operators, such as highest latency, to help you find potential issues more easily.
The thickness of the lines between operators indicates how many rows were returned between each step. This helps you follow the trajectory of the query execution, and pinpoint unexpected imbalances in your query execution.
Query plans can get pretty big. We implemented a mini-map to help you pan around the entire query, zooming, and a shortcut to a compact view so you can get a snapshot of your overall query plan. You can also use the query execution timeline to see which operators are executing in a particular machine group, which is a way to illustrate how Spanner executes a portion of the query.
Many of these features are also available in the query visualizer in the new Insights for Cloud SQL, another way we’re creating a more seamless experience for our database customers. You can learn more about how to read the query explanation and how to troubleshoot with it here.
We look forward to rolling out more enhancements to Spanner’s query page in the coming months, and continue to provide the best database for global scale, availability, and consistency in Cloud.
To get started, create a Cloud Spanner instance in your GCP account or in a Spanner Qwiklab and try the new query exerience.