azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Query Execution Plan Expensive Operator Highlighting

Open lewis-sanchez opened this issue 2 years ago • 4 comments

This PR isn't associated with any issue, but is an enhancement to Query Execution Plans in Azure Data Studio.

This PR adds a new action bar icon to query execution plans and allows a user to locate a node/operation based on the following metrics: image

This new widget can be opened by clicking on the following button in the action bar: image

*** By default the cost metric is chosen, but the user can switch between any of the other options seamlessly.

Clicking on Find results in node's being enclosed in an orange outlined box like this: image

In the event that a metric isn't present in a graph like attempting to look for "Actual Elapsed Time" in an estimated plan, than an information popup will appear stating that the property wasn't found. image

Below is a gif that demonstrates how the widget works: Highlight Expensive Operator

lewis-sanchez avatar Sep 09 '22 19:09 lewis-sanchez

Let's have a discussion about the design of this widget. The button says find which is not what it does. Also, it is not clear what the widget is supposed to do.

aasimkhan30 avatar Sep 09 '22 20:09 aasimkhan30

Pull Request Test Coverage Report for Build 3176197624

  • 35 of 261 (13.41%) changed or added relevant lines in 8 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.09%) to 42.318%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/sql/workbench/contrib/executionPlan/browser/executionPlanWidgetBase.ts 1 2 50.0%
src/sql/workbench/contrib/executionPlan/browser/executionPlanWidgetController.ts 0 1 0.0%
src/sql/workbench/contrib/executionPlan/browser/widgets/customZoomWidget.ts 2 4 50.0%
src/sql/workbench/contrib/executionPlan/browser/widgets/nodeSearchWidget.ts 3 21 14.29%
src/sql/workbench/contrib/executionPlan/browser/executionPlanView.ts 3 25 12.0%
src/sql/workbench/contrib/executionPlan/browser/azdataGraphView.ts 8 47 17.02%
src/sql/workbench/contrib/executionPlan/browser/widgets/highlightExpensiveNodeWidget.ts 17 160 10.63%
<!-- Total: 35 261
Files with Coverage Reduction New Missed Lines %
src/sql/workbench/contrib/executionPlan/browser/azdataGraphView.ts 2 7.94%
<!-- Total: 2
Totals Coverage Status
Change from base Build 3171915680: -0.09%
Covered Lines: 29326
Relevant Lines: 64481

💛 - Coveralls

coveralls avatar Sep 09 '22 20:09 coveralls

the dropdown and the Find button is overlapping. please fix.

alanrenmsft avatar Sep 09 '22 21:09 alanrenmsft

Was there a design discussion for this? I think it would be good to make a doc for this and go over it with some folks to make sure this is easy and intuitive to use and solves whatever problem we're looking to have it address.

A couple of general thoughts :

  1. Why does this only find the most expensive operator? What if I want to see the 2nd or 3rd most expensive - is there a way to do that easily?
  2. Is this bar shown all the time? It might be better to look into having a keybinding bring it up (similar to how the find widget works)
  3. If we know that some values won't be present in certain circumstances (like "actual" values in estimated plans) then it would be nice to just not show them at all.

Erin and I discussed what we had in mind for the behavior. We wrote a one pager where we discussed making the find expensive operator widget flexible enough to find a node based on a user specified metric instead of defaulting to a metric like cost every time. The suggestion for an adjustable metric came from user feedback and is mentioned in the one pager for this feature.

The answers to questions 1-3:

  1. We discussed highlighting several nodes and decided to highlight just a single node.
  2. The bar is only shown when the user opens it from the action bar. [(ctrl/cmd + f) is already used by the "Find Node" widget]
  3. I definitely like this suggestion and I will look into it.

lewis-sanchez avatar Sep 09 '22 22:09 lewis-sanchez