Thursday 25 October 2012

What happens to statistics if a table is renamed in Teradata?

What happens to statistics if a table is renamed in Teradata? Should we recollect the statistics or should the statistics exist already?

The statistics in the table are retained because Teradata internally stores the Table with TableID.
So, statistics are retained because there has been no demographic changes.

Let us consider the example below:

collect statistics on ta_62917_qrmdb.dummy1 column version_no;

à 1 row processed

help stats ta_62917_qrmdb.dummy1;

Date
Time
Unique Values
Column Names
12/10/2025
10:53:08
3
VERSION_NO


rename table ta_62917_qrmdb.dummy1 to ta_62917_qrmdb.dummy2;

à 2 rows processed

help stats ta_62917_qrmdb.dummy2;

Date
Time
Unique Values
Column Names
12/10/2025
10:53:08
3
VERSION_NO


Teradata internally stores only the Table-ID.