15.10 - Quick Functional Overview of the Query Capture Facility - Teradata Database

Teradata Database SQL Request and Transaction Processing

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
User Guide
featnum
B035-1142-151K

The Query Capture Facility, or QCF, provides a method to capture and store the steps from any query plan in a set of predefined relational tables called the query capture database, or QCD.

You create your QCD databases using the procedures described in Database Administration.

The principal source of the captured information in QCD is the white tree produced by the Optimizer, the same data structure used to produce EXPLAIN reports (note that the current implementation of QCD does not represent all the information reported by EXPLAIN). The white tree was chosen because it represents the output of the final stage of optimization performed by the Optimizer.

Statistical and other demographic information in the QCD is captured using the following set of SQL statements.

  • COLLECT DEMOGRAPHICS
  • COLLECT STATISTICS (QCD Form)
  • INSERT EXPLAIN … WITH STATISTICS
  • See SQL Data Manipulation Language and SQL Data Definition Language for further information.

    Teradata Database supports the following applications of QCF and QCD.

  • QCD provides the foundation for the Teradata Database Index Wizard utility.
  • This utility analyzes various SQL query workloads and recommends candidate indexes to enhance the performance of those queries or candidate columns in the context of the defined workloads

    The workload definitions, supporting statistical and demographic data, and index recommendations are stored in various QCD tables.

  • QCD can store all query plans for customer queries. You can then compare and contrast queries as a function of software release, hardware platform, and hardware configuration.
  • QCD provides the foundation for the Visual EXPLAIN tool, which displays EXPLAIN output graphically.
  • Visual EXPLAIN also has an option that compares different EXPLAIN reports. This feature can be used to compare visually the white trees of identical queries performed on different hardware configurations or software releases as well as comparing semantically identical but syntactically different DML statements to analyze their relative performance.

  • You can generate your own detailed analyses of captured query steps using standard SQL DML statements and third party query management tools by asking such questions as “how many spool files are used by this query,” “did this query plan involve a product join,” or “how many of the steps performed by this query were done in parallel.”
  • See Database Design for information about physical capacity planning for your QCDs.

    Note the following facts about the physical implementation of QCD databases.

  • All text columns that might contain names of any type are explicitly defined as Unicode to ensure proper handling of any Teradata-supported character set.
  • The table SeqNumber exists to feed the values of the artificial sequential number columns defined for several attributes in QCD.