Oracle SQL VARCHAR2 datatype storage -
from oracle docs :
if give every column maximum length or precision data type, application needlessly allocates many megabytes of ram. example, suppose query selects 10 varchar2(4000) columns , bulk fetch operation returns 100 rows. ram application must allocate 10 x 4,000 x 100—almost 4 mb. in contrast, if column length 80, ram application must allocate 10 x 80 x 100—about 78 kb. difference significant single query, , application process many queries concurrently. therefore, application must allocate 4 mb or 78 kb of ram each connection.
as know varchar2 variable length datatype, db allocate space used column, i.e. if column 10 character in unicode allocate 10 bytes. according above statement if column (max) 10 character, length of datatype defined 4000, still occupy 4000 bytes?
the space allocated on disk long required store actual data each row.
the space allocated in memory (in cases) maximum required based on datatype.
Comments
Post a Comment