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

Teradata® Data Mover User Guide

Teradata Data Mover
Release Number
Release Date
October 2021
Content Type
User Guide
Publication ID
English (United States)
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. 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">
     	<table selection="included" copyStats="true">

    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>
    The copyStats attribute is valid only for tables, hash indexes, and join indexes.