How to Deal With Teradata Stale Statistics

Roland Wenzlofsky

March 7, 2014

minutes reading time

When the degree to which a given set of statistics is a good representation of the current table demographics is under scrutiny, I often experience that people rely solely on the collection date.

Some tables will not have Teradata stale statistics even if you never refresh them. Just think about pretty static lookup tables. Various changes can occur for other tables, with some fields having ever-expanding value ranges and others having a constant share of only a few codes. How can you get a better picture of statistics and determine if they are stale? There are several possibilities. Maybe the easiest could be to just run a simple query on the table and use a WHERE CONDITION on the column, which should be tested.


Compare the number of estimated records (you can see this number in the Teradata Administrator) with the number returned, and you will know if the statistics are stale.

Note that you cannot expect the optimizer to be next to the individual row on any occasion. Still, the divergence should not be more significant than a small one-digit percentage,  depending on the overall table size.

  • Hi Alan,

    One example comes to my mind:

    In case the Teradata system configuration changes (for example, by adding nodes) and rows of a PPI Table are distributed to new partitions.

    This happens for example if you are using the HASHING functions of Teradata in the PARTITIONING definition of your table DDL:


    As a bigger system has more AMPS, rows are distributed differently to the partitions and the statistics become stale and have to be recollected.

    This is an example, where the table content stayed the same but statistics became stale.

  • Avatar
    Alan Dickson says:

    I was once advised to recollect statistics on all the static ‘lookup’ tables held in a database, on a monthly basis, ‘just in case’ the statistics needed to be refreshed…needless to say, I never saw a reason to do this as it never had any impact. Would there ever be a case where statistics become ‘stale’ and therefore ignored by the optimizer in such circumstances?

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    You might also like