|
|
Archives of the TeradataForum
Message Posted: Thu, 28 Jun 2001 @ 20:06:37 GMT
Subj: | | Re: Statistics about table statistics |
|
From: | | Rajiv Devulapalli |
Run this SQL. You may need to add more columns to it as needed.
-- column level stats.
Select distinct 'Collect Statistics on ',
trim(dbase.databasenamei)||'.'||
trim(tvm.tvmnameI) tblname, ' column ', tvf.fieldname, ' ;' from
dbc.tvfields
tvf , dbc.tvm tvm, dbc.dbase
where tvf.tableid = tvm.tvmid and tvf.fieldstatistics is not null
and tvm.databaseid = dbase.databaseid
and dbase.databasenamei = 'dbatlas'
UNION
-- index level stats.
select distinct 'Collect Statistics on ',
trim(dbase.databasenamei)||'.'||
trim(tvm.tvmnameI) tblname, ' index ', ind.name, ' ;'
from dbc.indexes ind , dbc.tvm tvm
where ind.tableid = tvm.tvmid
and ind.indexstatistics is not null
and tvm.databaseid = dbase.databaseid
and dbase.databasenamei = 'your_db_name'
order by 2, 3 ;
Rajiv Devulapalli
Gap Inc.,
| |