Download presentation
Presentation is loading. Please wait.
1
“ Possible representation (2) “
Welcome: To the fifth learning sequence “ Possible representation (2) “ Recap : In the previous learning sequence, we discussed four possible representations. Present learning: We shall explore the following topics: - The pointer chain. - The chain two-way. - The inverted organization.
2
Possible representation
- In this section we make a simple collection of sample data and consider some of many ways it could be represented in storage at the level of stored record interface.
3
Possible representation
The sample data is consists of information about the same five suppliers; for each supplier we wish to record the same attributes: Supplier number (S#), a supplier name (SNAME), and location (CITY).
4
Possible representation
5- An alternative to the previous representation (Combination Factoring out the city and Indexing on city) that avoids this problem is illustrated in fig5. The pointer chain.
5
Possible representation
Athens . London . Paris . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams Fig 5: Pointer chain
6
Possible representation
Athens . London . Paris . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams Fig 5: Pointer chain
7
Possible representation
Athens . London . Paris . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
8
Possible representation
Athens . London . Paris . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
9
Possible representation
Athens . London . Paris . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
10
Possible representation
Athens . London . Paris . . . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
11
Possible representation
Athens . London . Paris . . . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
12
Possible representation
Athens . London . Paris . . . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
13
Possible representation
Athens . London . Paris . . . . S1 Smith . S2 Jones S3 Black S4 Clark S5 Adams . Fig 5: Pointer chain
14
Possible representation
In this representation each occurrence (CITY or supplier) contains just one pointer. Each City pointed to the first supplier in that city. That supplier then points to the second supplier record occurrence in the same city, who points to the third, and so on, up to the last, which points back to the city.
15
Possible representation
Thus for each city we have chain of all supplier in that city. The advantage of this representation is that it is easier to apply change. The disadvantage is that, for a given city the only way to access the nth supplier is to follow the chain and access the 1st, 2nd,....,(n-1) the supplier too. If each access involves a seek operation, the time taken to access the nth supplier may be quite considerable.
16
Possible representation
6- Another extension to the above representation might be making the chain two-way (so that stored record contains exactly two pointers). The DBA might choose such a representation if deleting a supplier record is a common operation.
17
Possible representation
Fig5 (pointer chain) is a simple example of multilist organization when for each city we had a list of corresponding suppliers. In exactly the same way we could also have a list of suppliers for each distinct status value. In general a multilist organization can clearly contain any number of such lists.
18
Possible representation
7- To return to secondly indexing: just as it is possible to provide any number of lists in the multilist organization. It is also possible to provide any number of secondary indexes in organization. In the extreme case we have the situation illustrated in fig6 an indexing on every secondary field, or called inverted organization (the symbol ^ is used to mean pointer to).
19
Possible representation
SNAME Pointers Smith ^S1 Jones ^S2 Blake ^S3 Clark ^S4 Adams ^S5 SNAME Index Fig 6: Inverted Organization
20
Possible representation
SNAME Pointers Smith ^S1 Jones ^S2 Blake ^S3 Clark ^S4 Adams ^S5 STATUS Pointers 10 ^S2 20 ^S1, ^S4 30 ^S3, ^S5 STATUS Index SNAME Index Fig 6: Inverted Organization
21
Possible representation
SNAME Pointers Smith ^S1 Jones ^S2 Blake ^S3 Clark ^S4 Adams ^S5 STATUS Pointers 10 ^S2 20 ^S1, ^S4 30 ^S3, ^S5 CITY Pointers Athens ^S5 London ^S1, ^S4 Paris ^S3, ^S2 STATUS Index CITY Index SNAME Index Fig 6: Inverted Organization
22
Possible representation
SNAME Pointers Smith ^S1 Jones ^S2 Blake ^S3 Clark ^S4 Adams ^S5 S# S1 S2 S3 S4 S5 CITY Pointers Athens ^S5 London ^S1, ^S4 Paris ^S3, ^S2 CITY Index SUPPLIER FILE SNAME Index Fig 6: Inverted Organization
23
Possible representation
The organization will give good performance in response to a request for (all supplier with a given property). A request for (all properties of given supplier) will take a long time to answer.
24
Summary: In this learning sequence, we discussed the following topic:
- Three possible representations for some sample data.
25
END
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.