This approach should get you an approximate size without copying data:
SELECT yr, currentperm * prct
FROM
(
SELECT
SUM(currentperm) AS currentperm
FROM DBC.TableSizeV
WHERE DatabaseName = ...
AND TableName = ...
) AS dt1,
(
SELECT EXTRACT(YEAR FROM version_start_dt) AS yr, COUNT(*) AS cnt, CAST(cnt AS DEC(18,6)) / SUM(cnt) OVER () AS prct
FROM ...
GROUP BY 1
) AS dt2
Dieter
↧