Purpose
Captures the Optimizer white tree information for a query and writes it to a user-defined query capture database, optionally as an XML document.
For more information about index analysis, see:
- “BEGIN QUERY LOGGING” and “REPLACE QUERY LOGGING” in SQL Data Definition Language - Syntax and Examples, B035-1144.
- “COLLECT DEMOGRAPHICS”
- “COLLECT STATISTICS (QCD Form)”
- “DUMP EXPLAIN”
- INSERT EXPLAIN
- “INITIATE INDEX ANALYSIS”
- “RESTART INDEX ANALYSIS”
- SQL Request and Transaction Processing
- Database Design
- Teradata Index Wizard User Guide
- Teradata Viewpoint User Guide, B035-2206, chapter on Stats Manager
- Teradata Visual Explain User Guide
- Teradata System Emulation Tool User Guide
Required Privileges
You must have INSERT privileges on the tables in the user-defined query capture database.
You must also have the SELECT privilege on all referenced tables to capture data demographics and column statistics.
Syntax
Syntax Elements
- WITH STATISTICS
- Capture the statistics for the WHERE clause condition columns specified in SQL_statement.
- USING SAMPLE percentage
- USING SAMPLE percentage PERCENT
- Percentage of data to be read for collecting statistics.
- WITH NO STATISTICS
- Do not capture statistics for the WHERE clause condition columns specified in SQL_statement.
- AND DEMOGRAPHICS
- Collect table-level demographics as well as statistics.
- FOR table_name
- FOR database_name.table_name
- FOR user_name.table_name
- Set of tables for which data demographics and statistics details are either to be included or excluded for analysis by the Teradata Index Wizard, depending on whether you specify the WITH STATISTICS option or the WITH NO STATISTICS options, respectively.
- INTO QCD_name
- User-defined query capture database.
- AS query_plan_name
- Optional user-defined name under which the query plan information is to be stored. For information on object naming, see SQL Fundamentals .
- LIMIT
- LIMIT SQL
- LIMIT SQL =n
- Limit the size of the query, DDL, and view text captured for the QCD tables Query, Relation, and ViewText, respectively.
- FOR frequency
- Number of times SQL_statement is typically performed within its identified workload.
- CHECK STATISTICS
- Capture COLLECT STATISTICS recommendations for SQL_statement in the StatsRecs QCD table. See SQL Request and Transaction Processing .
- IN XML
- Capture the output as an XML document.
- NODDLTEXT
- Do not capture the DDL text in the XML document stored in qcd.XMLQCD.
- SQL_request
- DML request whose Optimizer white tree information is to be captured and written to the QCD.
ANSI Compliance
INSERT EXPLAIN is a Teradata extension to the ANSI SQL:2011 standard.