Collect and Copy Statistics | Teradata Data Mover - Collecting and Copying Statistics - Teradata Data Mover

Teradata® Data Mover User Guide - 20.01

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Teradata Data Mover
Release Number
20.01
Published
November 2023
Language
English (United States)
Last Update
2023-12-05
dita:mapPath
hlv1700545853003.ditamap
dita:ditavalPath
mpm1591127278842.ditaval
dita:id
don1467241476387
Product Category
Analytical Ecosystem
When copying statistics from the source to the target, first collect statistics on the source table, join index, or hash index. If statistics on the source have not been collected before trying to copy statistics from the source to the target, an error results.
  1. Create a table with n columns.
  2. Populate the table with rows.
  3. Use SQL to collect statistics: COLLECT STATISTICS <TableName> Column (Cols);
    • To collect statistics about multiple columns, provide a list of columns.
    • To collect statistics about a named join or hash index, type COLLECT STATISTICS <TableName> INDEX "IndexName".
    • To copy statistics after they have been collected, set the copyStats attribute to true. The default value of copyStats attribute is false. Below is an XML example of copying the statistics for a table, and the table itself, which is specified by the selection="included" attribute of the table element.
    <database selection="unselected">
    	<name>dbName</name>
     	<table selection="included" copyStats="true">
    		    <name>MyTable</name>
    		</table>
    </database>

    Statistics can be copied without copying the table itself by specifying the selection="unselected" attribute of the table element if the table already exists on the target. This rule also applies to hash and join indexes.

    If statistics are copied with the object, the object does not have to exist on the target prior to the copy. If the object already exists on the target, the object is overwritten during the copy, and statistics are copied to the target.

    Below is an XML example of copying statistics for a hash index:

    <index selection="unselected" copyStats="true">
    <name>Cust_Ord_HI </name>
    	<index_database>MyDB</index_database>
    	<index_type>HASH_INDEX</index_type>
    </index>
    The copyStats attribute is valid only for tables, hash indexes, and join indexes.