|
|
Archives of the TeradataForum
Message Posted: Tue, 13 Dec 2011 @ 07:47:18 GMT
Subj: | | Re: Tables which don't have stats |
|
From: | | Yong Boon |
Sravan,
This is the query to identify table that does not have any stats defined on column/index associated with.
SELECT a.databasename
, a.tablename
FROM dbc.tables a
LEFT OUTER JOIN ( SELECT databasename
, tablename
FROM dbc.ColumnStats
GROUP BY 1, 2
UNION ALL
SELECT databasename
, tablename
FROM dbc.IndexStats
GROUP BY 1, 2
UNION ALL
SELECT databasename
, tablename
FROM dbc.MultiColumnStats
GROUP BY 1, 2) b
ON a.databasename = b.databasename
AND a.tablename = b.tablename
WHERE b.databasename IS NULL
Regards,
YB
| |