nzsql -d database <<eof
SELECT
"Table Name",
the_label as "Statistics State",
count(*) as "# Of Columns",
TO_CHAR ( _v_table.reltuples, '999,999,999,999,999') AS "Table Rowcount"
FROM
(
SELECT
_v_relation_column.name as "Table Name",
CASE WHEN _v_statistic.recent IS NULL THEN 'not maintained '
ELSE
CASE WHEN _v_statistic.recent = 85 THEN 'Full '
WHEN _v_statistic.recent = 341 THEN 'Express '
WHEN _v_statistic.recent = 149 THEN 'Basic '
WHEN _v_statistic.recent = 1 THEN 'Full Min/Max OK '
WHEN _v_statistic.recent = 257 THEN 'Express Min/Max OK'
WHEN _v_statistic.recent = 129 THEN 'Basic Min/Max OK '
WHEN _v_statistic.recent = 0 THEN 'Full Outdated '
WHEN _v_statistic.recent = 256 THEN 'Express Outdated '
WHEN _v_statistic.recent = 128 THEN 'Basic Outdated '
WHEN _v_statistic.recent = 169 THEN 'Min/Max Only '
WHEN _v_statistic.recent = 170 THEN 'Unavailable '
WHEN _v_statistic.recent = 16554 THEN 'Unavailable '
ELSE _v_statistic.recent || ''
END
END as the_label,
_v_relation_column.objid
FROM
_v_relation_column
left outer join _v_statistic on
( _v_relation_column.name = _v_statistic.tablename AND
_v_relation_column.attnum = _v_statistic.attnum
)
WHERE
_v_relation_column.objid > 200000
AND upper(_v_relation_column.type) in ('TABLE','SECURE TABLE')
) the_subquery
LEFT OUTER JOIN _v_table ON the_subquery."Table Name" = _v_table.tablename
WHERE trim(the_label) NOT IN ('not maintained','Full','Express','Basic','Unavailable')
GROUP BY "Table Name", "Statistics State", "Table Rowcount"
ORDER BY "Table Name", "Statistics State";
eof
im seing a new vakue in the "recent" column: =426
ReplyDeleteCan anybody perhaps shed some light on what i means ?