NOTE: Visual SQL Tuning is not available in SQL Query Tuner Developer.

SQL Query Tuner can now parse an SQL query and analyze the indexes and constraints on the tables in the query and display the query in graphical format on The Visual SQL Tuning (VST) diagram, which can be displayed in either Summary Mode or Detail Mode. This helps developers, designers and DBAs see flaws in the schema design such as Cartesians joins, implied Cartesians joins and many-to-many relationships. The VST diagram also helps the user to more quickly understand the components of an SQL query, thus accelerating trouble- shooting and analysis.
This section is comprised of the following topics:
Changing Diagram Detail Display
Interpreting the VST Diagram Graphics

CHANGING DIAGRAM DETAIL DISPLAY

This section is comprised of the following topics:
\\
• [Choosing the Tuning Statement and Generated Case to Analyze|VISUAL SQL TUNING#tuningstatement]
\\
• [Viewing the VST Diagram Legend|VISUAL SQL TUNING#viewvst]
\\
• [Viewing Table Counts and Ratios|VISUAL SQL TUNING#viewtablecount]
\\
• [Viewing the Explain Plan|VISUAL SQL TUNING#viewexplain]
\\
• [Viewing the VST Diagram in Summary Mode|VISUAL SQL TUNING#viewvstsummary]
\\
• [Viewing the VST Diagram in Detail Mode|VISUAL SQL TUNING#viewvstdetail]
\\
• [Changing Detail Level for a Specific Table|VISUAL SQL TUNING#changedetail]
\\
• [Viewing All Table Fields|VISUAL SQL TUNING#viewallfields]
\\
• [Viewing Diagram Object SQL|VISUAL SQL TUNING#viewdiagram]
\\
• [Expanding Views in the VST Diagram|VISUAL SQL TUNING#expandviews]
\\
• [Viewing the Oracle Explain Plan Overlay|VISUAL SQL TUNING#vieworacleexplain]
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="cda416b9-b905-4df9-80dc-0b30d760010f"><ac:parameter ac:name="">tuningstatement</ac:parameter></ac:structured-macro>CHOOSING THE TUNING STATEMENT AND GENERATED CASE TO ANALYZE
If, from the Overview tab, you have run the tuning job using more than one tuning statement, from the Analysis tab, you can choose to see the SQL analysis of any one of the tuning statements.
\\
1On the Analysis tab, click the *Select* *statement of* *interest* list and choose the tuning statement you want to see analyzed here.
\\
\\
\\
!worddav73afc47617d6a741a142cab509845ddd.png|height=96,width=624!
\\
Notice that next to the statement of interest box another list *->ROOT{*}. This shows that the statement being analyzed is the original statement, without any of the generated cases. This is the default selection.
\\
\\
2 To choose the generated case to be analyzed, click the second *Select* *statement of* *interest* list and choose a generated case.
\\
\\
\\
!worddavd43f0ae5ed5af07bcca4a6706ba86963.png|height=183,width=624!
\\
After you make your selections, a new analysis is performed taking into consideration the statement and case you chose. A new diagram is displayed and the Index Analysis, Table Statistics, Column Statistics And Histograms, and Outlines are recalculated and updated.
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="0de126cd-e648-4b7e-b5e4-16c8d46ef546"><ac:parameter ac:name="">viewvst</ac:parameter></ac:structured-macro>VIEWING THE VST DIAGRAM LEGEND
!worddav96d44f2418a0fbdcbaf76dfef9e81c25.png|height=336,width=200! Click the *Diagram* *Legend* toggle \[ !worddav8aab98a41aadf8383b60ae5076242009.png|height=15,width=16! \] to view the legend and then click it again to hide it. All the icons used in the VST diagram are identified and in the Diagram Legend.
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
•
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="c3604a0b-dea2-40ef-be34-dac1e859792f"><ac:parameter ac:name="">viewtablecount</ac:parameter></ac:structured-macro>VIEWING TABLE COUNTS AND RATIOS
To view or hide table counts, two table join sizes and filtered result set ratios, click the Ratios and Counts icon \[ !worddav1ef2ba970e4e5e69385a67a914afbb31.png|height=16,width=16! \].
!worddavd7a340bdbffb4a4a1edb8adfdb0e60be.png|height=232,width=383!
\\
<span style="color: #5c836c">Green</span> numbers at top left of table represent the total number of rows in that table. In the above the MOVIERENTAL (MR) table has 5000 rows.
\\
<span style="color: #2e3092">Blue</span> percentage at the bottom right of the table represent the percentage of rows in that table that meet the selection criteria. In the above example, 100 percent of the rows in the RENTALITEM (RI) table have met the selection criteria.
\\
The numbers on the table joins indicate the total number of rows that meet the selection criteria for both tables.
\\
You can also view the SQL Query that created a relationship by hovering over the relationship. If the tool tip content is larger than the size of the tool tip rectangle, you can hover the mouse on top of the tooltip for a second, and then it will turn into a dialog you can re-size, scroll in, and select text from to copy into the Clipboard.
\\
!worddav6d878474660f7b46b69d206b2c615cdf.png|height=396,width=638!
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="ee9af5ad-d359-4b1f-beef-0ec422b6fb6d"><ac:parameter ac:name="">viewexplain</ac:parameter></ac:structured-macro>VIEWING THE EXPLAIN PLAN
<span style="color: #444087">NOTE:</span>  The Explain Plan is available only for the Oracle 10g platform.
\\
\\
Hover the mouse over the VST diagram to see the *Explain* *Plan* icon \[ !worddav6583ed313c70300392567770b0639c99.png|height=14,width=16! and then click it to view the Explain Plan Overlay. Click the *Explain* *Plan* icon again to hide the overlay.
\\
The additional nodes shown in the Explain Plan overlay provide details on the flow of the query plan, with operations (such as nested loops, sorts, and joins) showing connecting tables and other operations..
\\
!worddav3da30db6d152f9d1ecd896174e246cf7.png|height=264,width=368!
\\
Hover the mouse over the objects or relationships in the overlay to view additional details.
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="81e86c6e-0542-4b8d-b871-663c2c4ceec6"><ac:parameter ac:name="">viewvstsummary</ac:parameter></ac:structured-macro>\\
VIEWING THE VST DIAGRAM IN SUMMARY MODE
By default the diagram displays Summary Mode, showing only table names and joins, as seen in the following illustration
\\
!worddav143393be9011e9d2ed507c6bb3b20b3b.png|height=239,width=360!
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="b41a2228-1727-45ce-8b21-b4ca28c80fc1"><ac:parameter ac:name="">viewvstdetail</ac:parameter></ac:structured-macro>VIEWING THE VST DIAGRAM IN DETAIL MODE
By default, the VST diagram displays in Summary Mode, but by clicking the *Detail* *Mode/Summary* *Mode* switch.
\\
\\
\\
\\
\\
\\
\\
!worddav143393be9011e9d2ed507c6bb3b20b3b.png|height=239,width=361!<span style="color: #cc612c"><strong>DetaiMl</strong></span> <span style="color: #cc612c"><strong>odeS/</strong></span> <span style="color: #cc612c"><strong>ummaryMode</strong></span>
<span style="color: #cc612c"><strong>Switch</strong></span>
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
Additional details of the tables display, including table columns and indexes
\\
!worddavc7523ca896d5ec72f8ba35468ee41562.png|height=272,width=360!
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="43967ddf-c4c0-4adf-b304-4f9812da682a"><ac:parameter ac:name="">changedetail</ac:parameter></ac:structured-macro>CHANGING DETAIL LEVEL FOR A SPECIFIC TABLE
You can also switch between Summary Mode and Detail Mode for a specific table or view, by double-clicking the object name.
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="66ea9055-1b08-4037-84d3-43ee2e06f5c0"><ac:parameter ac:name="">viewallfields</ac:parameter></ac:structured-macro>VIEWING ALL TABLE FIELDS
By default, only fields that are used in the WHERE clause are displayed in detail mode; however, if you right-click the table you can choose to display even unused columns as follows:
\\
!worddavdcf2303e4aeeeb5fee118c56fd0db6f6.png|height=333,width=310!
\\
\\
All the columns in the table are shown, and not just the ones used in the WHERE clause of the SQL statement.
\\
!worddav99c6009e3b5ba642e447b35851011cbb.png|height=192,width=151!
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="25e2e84e-8267-4e23-8dac-779562c0e675"><ac:parameter ac:name="">viewdiagram</ac:parameter></ac:structured-macro>VIEWING DIAGRAM OBJECT SQL
While in Detail Mode, hovering the mouse over the sub query, table name, field, or index displays the SQL required to create that object.
\\
!worddavc583ade94dac2f43fb2575744f342855.png|height=205,width=392!
\\
Hovering over the join between two tables displays the relationship between the two tables.
\\
!worddav1c1fba2f563820cf387ecf76f0deedc9.png|height=328,width=480!
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="41c727a5-d7cc-4a94-8dae-5ea1b319d2c5"><ac:parameter ac:name="">expandviews</ac:parameter></ac:structured-macro>EXPANDING VIEWS IN THE VST DIAGRAM
If there are views in the Visual SQL Tuning diagram, they can be expanded by right clicking the view name and choosing *Expand* *View{*}.
\\
Right click on the view, and choose *Expand* *View{*}.
\\
!worddav09b1dadd741b3cfea0ab8314a4418519.png|height=288,width=301!
\\
Now we can see the objects in the view:
\\
!worddav0cf9ecff821440990f96a7b8943e1746.png|height=406,width=287!
\\
You can further expand the sub-view within the original view also.
\\
The following is an example of view expansion along with the Explain Plan to the left.
\\
\\
Notice in the view expansion a list of all the indexes on all the underlying tables in the views and sub views and which of those indexes is used in the default execution plan.
!worddav889aecdc632623353b70050f8354e7bb.png|height=416,width=536!
\\
\\
\\
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="49a91e2d-9ea1-4b5d-996f-c9b4527f3a9d"><ac:parameter ac:name="">vieworacleexplain</ac:parameter></ac:structured-macro>VIEWING THE ORACLE EXPLAIN PLAN OVERLAY
<span style="color: #444087">NOTE:</span>     This option is only available for Oracle versions 10 and higher.
\\
!worddave1fce4cc28faa7f43aae9108fd20c016.png|height=16,width=16!!worddav45149e4c8fd0d118d1b7d44938f6b2e6.png|height=16,width=14!Click the Explain Plan toggle \[\], you can choose to view or hide the Explain Plan details. The additional nodes shown in the Explain Plan overlay provide details on the flow of the query plan, with operations (such as nested loops, sorts, and joins) showing connecting tables and other operations. Hover the mouse over the objects or relationships to view additional details.
\\
!worddav3423955e062bf4983650f64bafbf1565.png|height=180,width=408!
\\

EXPANDING SUBQUERIES AND NESTED SUBQUERIES

Double-click queries to expand them or right-click the query and select Expand Query from the menu that appears. The following shows several layers of nesting queries.