Archives of the TeradataForum
Message Posted: Thu, 08 Nov 2001 @ 18:16:33 GMT
The statistics are kept at a column level in table DBC.TVFIELDS, column FIELDSTATISTICS. If FIELDSTATISTICS is NULL, then statistics have not been collected for that column. So you might try a query like (I didn't get a chance to test the query first):
SEL D.DATABASENAME (NAMED DATABASE_NAME) , T.TVMNAME (NAMED TABLE_NAME) , F.FIELDNAME (NAMED COLUMN_NAME) FROM DBC.DBASE D , DBC.TVM T , DBC.TVFIELDS F WHERE D.DATABASEID = F.DATABASEID AND T.TVMID = F.TABLEID AND F.FIELDSTATISTICS IS NOT NULL ORDER BY 1,2,3;
The above query is for columns. For an index, then you need to do a similar query against DBC.INDEXES, column INDEXSTATISTICS (instead of DBC.TVFIELDS, column FIELDSTATISTICS).
For what it's worth: The date/time of when the statistics were collected are embedded in the FIELDSTATISTICS/INDEXSTATISTICS columns. You can substring those columns to extract the ASCII date/time values (sorry, I don't have my notes at hand and so I can't tell you the specific columns).
Does anybody know the specific fields that make-up FIELDSTATISTICS/INDEXSTATISTICS? Last time I heard, they weren't formally documented.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|