Azure Data Studio – Execution Plans

If you’ve ever had to get involved in query performance you’ll have used execution plans. Azure Data Studio gives execution plans too but they’re a little tricky.

Let’s build a quick query and gather our execution plans. This query will work on any database;

In your query editor window the obvious button is the ‘Explain’ button. This works and will give you the estimated query plan.

You’ll recognise the execution plan that you see in ADS as it looks very much like the same version in SSMS.

Estimated plan in Azure Data Studio

Here’s what it would have looked like in SSMS

The same plan in SSMS

One advantage ADS has over SSMS is that you can also see the Top Operations natively.

This has been possible in Sentry One Plan Explorer for a long time but it’s also now native in ADS. It’s great when you’re looking at a massive plan and want to drill down into the major pain points quickly.

Getting the actual execution plan is a little more complicated. It’s not a nice easy button so you’ll want to get used to shortcuts.

press Ctrl+Shift+P to open the command palette and type ‘run’. You’ll notice the command to ‘Run Current Query with Actual Plan’. That’s the ticket;

You’ll also notice that there’s an even better shortcut. Ctrl+M is going to execute the query and give you the actual plan.

There is currently a gotcha with ADS actual execution plans where it only renders the last code block. There is an open github issue for this so keep an eye on it as there’s new stuff being released every month.