March 7


How to Deal With Teradata Stale Statistics

By Roland Wenzlofsky

March 7, 2014


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 lookup tables which are quite static. For other tables, various degrees of changes can occur, with some fields having ever-expanding value ranges and others a constant share of only a few codes. How can get a better picture about statistics and find out if they are stale?  There are several possibilities. Maybe the easiest could be to just run a simple query on the table and using 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 real number returned and you know if the statistics are stale.

Note that you cannot expect the optimizer to be right down to the individual row on any occasion, but the divergence should not be any larger than a small one-digit percentage,  depending on the overall table size.

Roland Wenzlofsky

Roland Wenzlofsky is a graduated computer scientist and Data Warehouse professional working with the Teradata database system for more than 20 years. He is experienced in the fields of banking and telecommunication with a strong focus on performance optimization.

You might also like

  • 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"}

    Never miss a good story!

     Subscribe to our newsletter to keep up with the latest trends!