SQLXPress Visual Query Tuner Copyright © 2014 Merlon Software Corporation.

Slides:



Advertisements
Similar presentations
UT-Space Manager. Define Rooms The Define Rooms task is used to manage your room data. 1.On the Process Navigator, click on the Space Inventory & Performance.
Advertisements

EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Technical BI Project Lifecycle
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Automating Tasks With Macros
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
XP New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 5 1 Microsoft Office Excel 2003 Tutorial 5 – Working With Excel Lists.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Concepts of Database Management Sixth Edition
Access Tutorial 10 Automating Tasks with Macros
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Advanced Tables Lesson 9. Objectives Creating a Custom Table When a table template doesn’t suit your needs, you can create a custom table in Design view.
XP 1 Microsoft Office Excel 2003 Tutorial 3 – Working With Excel Lists.
Chapter 3 Maintaining a Database
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
6 Copyright © 2004, Oracle. All rights reserved. Working with Data Blocks and Frames.
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Working with a Database
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
XP Agenda Video Last Class Excel Tutorial 5: Working with Excel Lists Agenda for Next Class 1 New Perspectives on Microsoft Office Excel 2003 Tutorial.
© 2002 Page 1 NonStop dba/m® 09/04/2002 NonStop ™ dba/m® Improving management of NonStop SQL databases Copying and Use Restrictions: Material under this.
Developers of a suite of products to help you monitor and optimize Windows/SQL Server performance o Performance Advisor – awareness and control over Windows.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
CSS/417 Introduction to Database Management Systems Workshop 2.
Analyzing Data For Effective Decision Making Chapter 3.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Switchboards, PivotTables, and PivotCharts.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
Key Applications Module Lesson 21 — Access Essentials
Concepts of Database Management Seventh Edition
Chapter 17 Creating a Database.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Access Project 7 Advanced Report and Form Techniques.
TUTORIAL 9 INSTRUCTOR: HANIF ULLAH ID: OFFICE #: 2029 DATE: 22/04/2012 Introduction to MS Project 2007.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
McGraw-Hill/Irwin The O’Leary Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Lab 3 Analyzing Tables and Creating.
What are queries? Queries are a way of searching for and compiling data from one or more tables. Running a query is like asking a detailed question of.
XP. Objectives Sort data and filter data Summarize an Excel table Insert subtotals into a range of data Outline buttons to show or hide details Create.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
SQLXPress Make the most of NonStop SQL with a comprehensive set of easy to use productivity tools.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 6 BACKNEXTEND 6-1 LINKS TO OBJECTIVES Using the Report Button Using the Report Button Print.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
Change Display of a Key Figure While in the Change Query (Local Definition) Hiding 1.Right click.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
21 Copyright © 2009, Oracle. All rights reserved. Working with Oracle Business Intelligence Answers.
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
Chapter 4 Crystal Report Presenter: PEN PHIROM (MscIT) Phone:
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Copyright © 2016, SAS Institute Inc. All rights reserved. HIDDEN GEMS IN SAS ENTERPRISE GUIDE.
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
Working with Data Blocks and Frames
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Practical Office 2007 Chapter 10
Presentation transcript:

SQLXPress Visual Query Tuner Copyright © 2014 Merlon Software Corporation

Agenda Introduction to Visual Query Tuner (VQT) How to generate a plan How to read a plan Measuring query performance Influencing plans Comparing performance Auto-tuner

Introduction VQT is a Windows ® application Connects to SQLXPress server process running on a NonStop system Supports both MX and MP queries  MX version or later  MP version 350 or later

Introduction VQT uses a NonStop SQL database to store query details  Each query has a name and plain language description Keeps a history of ”snapshots” for each query Each snapshot contains:  Query text  Plain language description of snapshot  Params, defines, and CONTROL statements  Execution plan  Execution statistics

Introduction Why use VQT?  Learn how query is executed  Get performance characteristics of query  Identify problems in a plan  Try remedial changes, for example: Update statistics Database changes (create index) Query changes (predicate re-write) Use of SQL CONTROL statements (CQD, CQS)  Compare performance after remediation

How to generate a plan Use the Query tab to enter query detail  Color-coded syntax  Auto-completion  Query text will most likely be pasted from clipboard Click Take Snapshot to save query, generate plan, and collect execution statistics

How to generate a plan The first Take Snapshot command prompts for a query name Subsequent Take Snapshot commands for the same query use the same name  Use Save Snapshot As to save under a new name  Use New command to start working on a new query Each snapshot is identified by the query name and the time the snapshot was taken

How to generate a plan Snapshot Management  Take snapshot command adds a new snapshot  Delete snapshot command deletes current snapshot Also has delete snapshots dialog to delete multiple snapshots with one command  Easy to navigate snapshots from toolbar  Snapshot retention – automatically delete oldest snapshot when retention limit exceeded  Use any snapshot as staring point for new query “experiment”

How to read a plan Plans are displayed in the Execution Plan tab Plans displayed in three different ways:  Summary – key attributes of each operator  Details – plan outline, plus complete details on each operator  Plan Diagram – a truly visual plan depiction

How to read a plan Plan Summary (MX) Lists each operator Key operator attributes Similar to HP’s VQP

How to read a plan Plan Summary (MP) Lists each operation Shows index and table selectivity

How to read a plan Plan Details (MX) Tree view on left provides plan outline Complete plan text on right shows operator details Click a node in the outline to show details for selected operator Similar to HP’s VQP, but viewing operator details is much easier

How to read a plan Plan Details (MP) Outline shows steps and operations Click on node in outline to show details of step / operation

How to read a plan Plan Diagram (MX) Plan displayed as a tree Much more intuitive layout than traditional tree view There is a lot of information in the diagram

How to read an MX plan diagram Plan fragments are color-coded Data flows between fragments shown as heavy dotted line Data flows within a fragment shown as lighter solid lines Full table / index scan operators have heavy red borders Operators that run in parallel are “stacked” Estimated row count displayed above each operator Operator details displayed in popup window

How to read a plan Operator details can be displayed in a popup window Move mouse over an operator to display details Move mouse away, popup is dismissed

How to read a plan Plan Diagram (MP) Plan displayed as a tree Both steps and operations are represented by nodes Similar to MX diagram

How to read a plan Various ways to mitigate problems displaying large plans  Scroll and zoom  Fit to page  Left to right – may be better than top to bottom on wide-screen monitors  Simplified MX plan diagrams

How to read a plan Simplified Plan Tree (MX) Suppress display of:  ESP Exchange  Split Top  Partition Access Fewer nodes to display Diagram visually indicates fragment boundaries and parallel operators

Measuring query performance Take Snapshot command automatically runs query to gather execution statistics  Can be turned off in Options Use Run Query command to explicitly run the query without creating a new snapshot  Use to collect multiple samples of execution statistics  Avoid cache bias by running query more than once Run Query does not display query results  Rows are discarded as soon as they are received by the server process Execution Statistics tab shows results from Run Query

Measuring query performance Execution Statistics Shows compile time and execution time Per-table statistics, like those shown by MXCI / SQLCI Shows min, max, avg values for multiple samples

Influencing plans There are various techniques to try and make query run faster  Update Statistics  Adjust access paths For example, add or modify an index  Use SQL Control statements For example, force join order, join method, parallelism  Adjust the query text Rewrite the query while still returning the same set of rows

Influencing plans - Update Statistics Use View Table Statistics command Current statistics are displayed for tables in the query From here you can update statistics

Influencing plans – Access Paths Use View Access Paths command Access paths for tables in query are displayed From here you can create or drop indexes Click Object Properties to view properties (including DDL)

Influencing plans – SQL Control Statements For MX:  CONTROL QUERY DEFAULT  CONTROL QUERY SHAPE  CONTROL TABLE For MP:  CONTROL QUERY  CONTROL EXECUTOR  CONTROL TABLE Specify CONTROL statements on Query tab Stored in database as part of query snapshot

Influencing plans example - MX CQD Example of CQD Click Edit to set CQD values

Influencing plans example - MX CQD Edit CQD dialog Click on link to get popup help on a CQD attribute Many attributes have pick-list of valid values Values that are Not Specified will take default value

Influencing plans example - MX CQS CQS tab Enter CQS statement Click Show to issue SHOWSHAPE to get current shape which you can then edit  Drag divider up to make more room when editing shape

Influencing plans example – MP Control Executor / Query tab  Parallel Plans  MDAM  Interactive Access Join Control tab  Specifies join sequence and join method Control Table tab  Additional control table statements

Influencing plans – adjust query text Change the query text in a way that helps the optimizer produce a better plan, but returns the same rows as before Avoid using columns as function parameters (including CAST) to allow use of an index Add additional redundant predicates to avoid full table scans Don’t aggregate data in the application, use the SQL aggregate functions Only select the columns you actually need

Influencing plans – example use of functions Suppose ORDERPLACED is a TIMESTAMP column To query yesterday’s orders:  Instead of: CAST (O.ORDERPLACED AS DATE) = CURRENT_DATE - INTERVAL '1' DAY  Use: O. ORDERPLACED >= CAST(CURRENT_DATE - INTERVAL '1' DAY AS TIMESTAMP) AND O. ORDERPLACED < CAST(CURRENT_DATE AS TIMESTAMP) If there is an index on ORDERPLACED this will avoid a full table scan

Influencing plans – example redundant predicates Instead of: select * from dept d where d.deptnum in (1000, 3000, 4000) Use: select * from dept d where d.deptnum in (1000, 3000, 4000) and d. deptnum >= 1000 and d. deptnum <= 4000 This will avoid a full table scan There are more examples of query rewrite in the VQT User Guide

Comparing performance After you make adjustments to a query, you should determine if the performance has improved  Take a new snapshot  Compare the performance with previous snapshots Use the View Performance Charts command to compare execution statistics

Comparing performance Chart shows stats for all snapshots Various Data Values:  Response Times  Records Read / Used  Number of Messages  Message Bytes Show sample:  Minimum  Maximum  Average

Comparing performance This is example uses line chart Shows records read and records used

The Auto-tuner Try other remediation techniques first Auto-tuner only works on SELECT statements May not work on some queries  Publish / subscribe  Queries using complex views Multi-step wizard Allows user to take snapshot based on recommended query and SQL control statements

The Auto-tuner Goals  Get a robust execution plan  Get good (but not necessarily the best) performance How it works  Analyzes query text  Determines available access paths  Collects metrics on joins and predicates Can use queries against tables, or ask the user  Generates recommendations: May include create / modify index recommendations Re-written query text SQL CONTROL statements

The Auto-tuner For robustness:  Use nested joins Scale well with increased table sizes Lower memory requirements compared to hash and merge joins Don’t require temporary disk space for hash or sort For performance  Determine best join order Drive query from table with best filter For the rest of the join order –Prefer joins to master tables over detail tables –Prefer joins to well filtered tables –Prefer joins with lower join ratios

The Auto-tuner For performance:  Support driver table filter with an index  Support joins to detail tables with index on foreign key  Prohibition on hash joins may be relaxed in some circumstances

The Auto-tuner Recommendations report Includes query re-write and SQL CONTROL statements

The Auto-tuner Post analysis actions Select a recommendation and click Go to implement