Presentation is loading. Please wait.

Presentation is loading. Please wait.

Variable Length Data and Records Eswara Satya Pavan Rajesh Pinapala CS 257 ID: 221.

Similar presentations


Presentation on theme: "Variable Length Data and Records Eswara Satya Pavan Rajesh Pinapala CS 257 ID: 221."— Presentation transcript:

1 Variable Length Data and Records Eswara Satya Pavan Rajesh Pinapala CS 257 ID: 221

2 nameaddressgenderbirth date Example Fig 1 : Movie star record with four fields 0 30 286 287 297

3 Records with Variable Fields An effective way to represent variable length records is as follows  Fixed length fields are Kept ahead of the variable length fields  Record header contains Length of the record Pointers to the beginning of all variable length fields except the first one.

4 Records with Variable Length Fields birth datenameaddress header information record length to address gender Figure 2 : A Movie Star record with name and address implemented as variable length character strings

5 Records with Repeating Fields  Records contains variable number of occurrences of a field F  All occurrences of field F are grouped together and the record header contains a pointer to the first occurrence of field F  L bytes are devoted to one instance of field F  Locating an occurrence of field F within the record Add to the offset for the field F which are the integer multiples of L starting with 0, L,2L,3L and so on to locate We stop upon reaching the offset of the field F.

6 Records with Repeating Fields nameaddress other header information record length to address to movie pointers pointers to movies Figure 3 : A record with a repeating group of references to movies

7 Figure 4 : Storing variable-length fields separately from the record addressname record header information length of name to address length of address to name to movie references number of references Records with Repeating Fields

8 Advantage  Keeping the record itself fixed length allows record to be searched more efficiently, minimizes the overhead in the block headers, and allows records to be moved within or among the blocks with minimum effort. Disadvantage  Storing variable length components on another block increases the number of disk I/O’s needed to examine all components of a record. Records with Repeating Fields

9 A compromise strategy is to allocate a fixed portion of the record for the repeating fields  If the number of repeating fields is lesser than allocated space, then there will be some unused space  If the number of repeating fields is greater than allocated space, then extra fields are stored in a different location and  Pointer to that location and count of additional occurrences is stored in the record Records with Repeating Fields

10 Variable Format Records  Records that do not have fixed schema  Variable format records are represented by sequence of tagged fields  Each of the tagged fields consist of information Attribute or field name Type of the field Length of the field Value of the field  Why use tagged fields Information – Integration applications Records with a very flexible schema

11 Variable Format Records Fig 5 : A record with tagged fields N16SS14Clint EastwoodHog’s Breath InnR code for namecode for restaurant owned code for string type length

12 Records that do not fit in a block  When the length of a record is greater than block size,then then record is divided and placed into two or more blocks  Portion of the record in each block is referred to as a RECORD FRAGMENT  Record with two or more fragments is called SPANNED RECORD  Record that do not cross a block boundary is called UNSPANNED RECORD

13  Spanned records require the following extra header information A bit indicates whether it is fragment or not A bit indicates whether it is first or last fragment of a record Pointers to the next or previous fragment for the same record Spanned Records

14 Records that do not fit in a block Figure 6 : Storing spanned records across blocks record 1 record 3 record 2 - a record 2 - b block header record header block 1 block 2

15 BLOBS  Large binary objects are called BLOBS e.g. : audio files, video files  Storage of BLOBS  Retrieval of BLOBS


Download ppt "Variable Length Data and Records Eswara Satya Pavan Rajesh Pinapala CS 257 ID: 221."

Similar presentations


Ads by Google