Chat now with support
Chat with Support

SQL Optimizer for SAP ASE 3.9.1 - User Guide

Introduction Tutorials Preferences Editor Functions SQL Information and Functions Performance Monitor SQL Inspector SQL Collector for Monitor Server SQL Scanner Index Advisor SQL Optimizer
SQL Optimizer Overview Optimization Engine Common Coding Errors in SQL Statements What Function Should l Use to Retrieve the Run Time? Unsatisfactory Performance Results SQL Optimizer Functions SQL Editor Optimized SQL Activity Log
SQL Worksheet SQL Formatter Database Explorer Code Finder Object Extractor SQL Repository Index Impact Analyzer Index Usage Analyzer Configuration Analyzer Migration Analyzer Abstract Plan Manager User-Defined Temp Tables SQL History Legal Information

Use Saved Abstract Plans

To use the abstract plan in your applications you have to either enable the abstract plan loading in the server-wide mode or enable the Abstract Plan loading for the session-level inside your application

The abstract plans that you want all applications to use must be saved in the ap_stdin group. If you want different abstract plans for different applications, you must save them in a group and associate it with a user.

Using Abstract Plans for Specific Applications

To use the Abstract Plans for specific users, you enable the use of the Abstract Plan for a specific group on a session level. Therefore, if you have saved abstract plans in a specific group and you want to use them, you need to tell Adaptive Server to use the abstract plans in that group. In your application you need to add the following commands:

Note: If the abstract plan is used by many users, you must have already imported the abstract plan for each user.

Example:

set plan load group_name on

go

*some queries*

go

set plan load off

go

Using the Abstract Plans Server Wide

You can enable Adaptive Server to use the abstract plans server-wide from the default group of ap_stdin.

To use the same abstract plan for all applications, the system administrator must set the abstract plan load sp_configure parameter to 1. Adaptive Server then uses the stored abstract plans from the default group ap_stdin.

Note: You can override the use of the abstract plan from ap_stdin for a specific SQL statement with the session-level "set plan load" command in the application.

 

Related Topics

Abstract Plan Compatibility with Original SQL

Abstract Plan Manager Window

Open the Abstract Plan Manager

Abstract Plan Group Functions

Export a Group to a Table

Import an Abstract Plan for each User

Abstract Plan ID Functions

User-Defined Temp Tables

User-Defined Temp Table Overview

The technique of creating temporary tables to extract data from permanent tables is often used. Because the existent of the local temp table is session related, you need to create these temporary tables in your current session. The User-Defined Temp Table window allows you to create temp tables to use so that you may optimize and analyze SQL statements that use temporary tables. Besides temporary table that you create using the User-Defined Temp Table window, temporary table may also be created during the scanning by the SQL Scanner and during the optimization process by the SQL Optimizer.

Note: Temporary Tables created in the User-Defined Temp Table module are not available in the SQL Worksheet module since a new database session is used to execute commands in the SQL Worksheet.

 

Related Topics

Create Temporary Tables

Temporary tables only exist in your current session. In order to optimize a SQL statement that uses temporary tables, these tables need to be created in this session before you optimize. The User-Defined Temp Table window allows the creation of temporary tables to be use throughout modules that use the original sessions that is created as you logon.

Temporary tables created in the User-Defined Temp Table module are used in the SQL Optimizer and SQL Scanner and can be viewed in the Database Explorer. An icon displays in the status bar of the main window to indicate at least one temporary table was created under the current session.

Temporary tables are dropped when you

  • Exit from the program

  • Reconnect with the same or a different user logon

  • Drop it using the User-Defined Temp Table module

To create temporary tables

  1. Click image\B_UserDefinedTempTable.gif.

  2. Enter the SQL for creating the temporary table on the Creation tab. Multiple commands can be entered.

  3. Click Execute.

After the temporary table is created you will notice an icon image\I_TempTable.gif on the bottom right of the main window status. This icon disappears when all user-defined temporary tables are dropped.

The User-Defined Temp Table module only supports SQL statements that create or modify temporary tables; these are:

  • SELECT INTO

  • CREATE TABLE

  • CREATE INDEX

  • DROP INDEX

  • DROP TABLE

  • INSERT

  • UPDATE

  • DELETE

Note: Temporary tables created within the User-Defined Temp Table window can be used in all modules but the SQL Worksheet. The SQL Worksheet module creates a separate session so temporary tables created in the User-Defined Temp Table cannot be used in the SQL Worksheet and vice versa.

 

Related Topics

Related Documents