Sr Application Developer.
Bill, June 28, 2004 - 3:58 pm UTC
This is probably a silly question, but I have never shrunk a varchar2 field to a smaller value and I don't have a database handy that I can play with. Increasing it is very quick, would shrinking it involve every row of the users 250 million row table being checked for truncation of an existing value or would it simply truncate the data when it is read?
June 28, 2004 - 4:26 pm UTC
it needs to validate the data, it would take a while.
The amazing shrinking column
David Scott, June 28, 2004 - 5:48 pm UTC
You might also consider these steps:
- add a new column of the proper length with a "_temp" name
- update the new column using SUBSTR or other function
- rename the old column with an "_old" name
- rename the "_temp" column to the proper column name
- adjust indexes and triggers
- alter table ... set unused ("_old" column); OR drop the column
Depending on your environment, you might see a speed advantage, although this increases your storage overhead.
YMMV...