variable length field


variable length field

A record structure that holds fields of varying lengths. For example, PAT LOPEZ would take nine bytes and GEORGINA ALLISON BARTHOLOMEW would take 28 plus a couple of bytes that define the length of the field. If fixed length fields were used, at least 28 bytes would have to be reserved for both names.

Variable Length Text Fields
Years ago, storage was costly, and variable field lengths were essential. Today, storage is dirt cheap by comparison. However, if there are text elements in a database that vary greatly, variable length fields save space. In addition, databases in many companies have reached mammoth proportions, and storage savings are welcome.

More Processing
Variable lengths require more processing, because every field has to be encoded into the variable format before being written to storage. Conversely, after being read into memory, the variable fields generally must be converted to a fixed length for processing.

The Compression Alternative
Even more storage is saved by using fixed length fields and compressing the data. With text, all contiguous blank spaces are filtered out. See real-time compression.


Size Matters
It can be difficult to figure out the size of a fixed length field. In the 1980s, this last name in the Manhattan White Pages had, count 'em, 25 letters.







CSV - Variable Length Fields
The comma separated values (CSV) format separates fields by commas, which results in variable length fields. Following are two CSV formats. See CSV.

 MN573,T-shirt,Green,18.95 AY621,Blouse,Blue,22.95 "MN573","T-shirt","Green","18.95" "AY621","Blouse","Blue","22.95"