Archives of the TeradataForum
Message Posted: Tue, 04 Feb 2003 @ 16:43:03 GMT
Subj: | | Re: CHAR vs VARCHAR |
|
From: | | Judge, James A |
Two things to try for evaluation of column (this assumes you have the column in a table in Teradata.
Use the CHAR (charlength operator) to find avg length of varchar Select AVG (CHAR (varcharcolumn) from tablename. This will tell you if
the 2 byte overhead is worth it based on the average length of column data.
Do a compress evaluation by Select columnname, COUNT(*) from tablename group by 1 order by 2 desc; . If there is a value that is in say
20% of the rows (actually you could code that calculation in the previous SQL using a derived table for COUNT(*) for all row count). And
the amount of bytes saved would be less than the 1st query value (+2byte overhead X # of rows); you get the idea.
|