SEQUENCED Option | SHOW STATISTICS | Teradata Vantage - 17.10 - About the SEQUENCED Option - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

The output of the SHOW STATISTICS VALUES option is a spool with a set of output request rows. If the table-level SHOW STATISTICS VALUES, or if you specify multiple column or index sets, the response can contain output from multiple statistics. The SEQUENCED option, which is only valid if you also specify the VALUES option, enables you to report sequence numbers for each such sequence of statistics data in a spool. The database uses the sequence number to identify the boundary of the each statistics output.

For example, assume you are interested in reported detailed statistics for 3 statistics on a table, and the individual detailed statistics have the following sizes.

Statistics Group Size (KB)
1 150
2 30
3 100

The database inserts the output of the 3 statistics groups into a spool along with sequence numbers that can be used to maintain the correct order of the output request text. The spool for the output is chunked into sequences up to 64 KB each. The database inserts up to 64 KB of the output request text into the first sequence, and whatever remains into subsequent sequences.

The final output with sequence numbers for this example is as follows. Because statistics output 2 is only 30 KB, it all fits into a single sequence.

Statistics Output Sequence Number Size (KB)
1 1 64
2 64
3 22
2 1 30
3 1 64
2 36

The following examples demonstrate different uses of the SEQUENCED option.

The following SHOW STATISTICS request displays all the available detailed statistics for table_1 with sequence numbers.

SHOW STATISTICS VALUES SEQUENCED ON table_1;

The following SHOW STATISTICS request displays the detailed statistics on column x1 from table_1 with sequence numbers.

SHOW STATISTICS VALUES SEQUENCED COLUMN x1 ON table_1;

The following SHOW STATISTICS request displays the detailed statistics on columns x1 and y1 from table_1 with sequence numbers.

SHOW STATISTICS VALUES SEQUENCED COLUMN x1, COLUMN y1 ON table_1;

The following SHOW STATISTICS request displays all of the available detailed statistics for table_1 with sequence numbers in XML format.

SHOW IN XML STATISTICS VALUES SEQUENCED ON table_1;