|
|
Archives of the TeradataForum
Message Posted: Thu, 22 Dec 2011 @ 09:06:30 GMT
Subj: | | Re: Calculating uncompressed Size |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Wednesday, December 21, 2011 23:49 -->
Hi,
The below query will get you all the tables with compression and their current perm size.
SELECT dbt.DATABASENAME,
dbt.TABLENAME,
MAX(CASE WHEN (compressvaluelist IS NOT NULL)
THEN (CASE WHEN INDEX(compressvaluelist,',') > 0
THEN '3. MVC '
ELSE '2. SVC '
END)
ELSE '1. NONE'
END) COMPRESS_TYPE,
MIN(pds.Current_Perm) CURRENT_PERM
FROM dbc.columns dbt,
(SELECT t.DATABASENAME,
t.TABLENAME,
SUM(ts.CurrentPerm) CURRENT_PERM
FROM DBC.Tables t,
DBC.TableSize ts
WHERE t.DATABASENAME = ts.DATABASENAME
AND t.TABLENAME = ts.TABLENAME
AND ts.TABLENAME <> 'ALL'
HAVING CURRENT_PERM > 1000000000
GROUP BY 1,2) pds
where dbt.DATABASENAME = pds.DATABASENAME
AND dbt.TABLENAME = pds.TABLENAME
-- HAVING COMPRESS_TYPE = '1. NONE'
GROUP BY 1,2
ORDER BY 1,3, 4 DESC,2
Based on the result, you can analyze all the tables which are not compressed and then apply compression on then and compare the
difference in perm space.
HTH.
| |