200 likes | 275 Views
Welcome: To the sixth learning sequence “ Possible representation (3) “ Recap : In the previous learning sequence, we discussed four possible representations. Present learning: We shall explore the following topics: - Hierarchical organization. - Hash – addressing.
E N D
Welcome:To the sixth learning sequence “ Possible representation (3) “ Recap : In the previous learning sequence, we discussed four possible representations. Present learning: We shall explore the following topics: -Hierarchical organization. - Hash – addressing. - Network data structure.
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.
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), a status value (STATUS), and location (CITY).
Possible representation 8- Another representation that should be mentioned is the hierarchical organization; illustrated in fig7 • Here we have one stored file containing three (hierarchical) stored record occurrences, one for each city. • Part of each stored record occurrence consists of variable _ length (list) of supplier entries. One for each supplier in that city and each supplier entry contains supplier number, name, and status.
Possible representation Fig 7: Hierarchical Organization
Possible representation Fig 7: Hierarchical Organization
Possible representation Fig 7: Hierarchical Organization
Possible representation Fig 7: Hierarchical Organization
Possible representation 9- The basic idea of Hash – addressing is that each stored record occurrence in the database at a location whose address (SRA) may be completed as name function (hash function) of a value that appears in that occurrence – usually the primary key value.
Possible representation • Thus to store the occurrence initially. That (DBMS) compute the (SRA) and instruct the Access method to place the occurrence (record) at that position. To retrieve (access) the occurrence (record), the DBMS perform the same computation (algorithm) as before and then request the access method to fetch the occurrence at that computed position. • The advantage of this organization is that provides very fast direct access on the basic of values of the hashed field.
Possible representation • As an example of hash – addressing let us assume that the S # values are (100,200,300,400,500) and let us consider the hash function (algorithm). • SRA=remainder after dividing by 13 • The SRA = for the five supplier are there 9 , 5 , 1 , 10 , 6 respectively, giving us there representation shown in fig 8.
Possible representation Fig 8: A Hash-addressing Organization
Possible representation 10- A Network data structure allows any entity to have any number of subordinates or superiors. A network structure is shown in figure 9. Entities are connected using network links, which are data items common to both of the connected entities. Some of problems inherent in hierarchical structures can be alleviated using the network structure, but the network structure is more complex.
Possible representation Entity Entity Link Link Link Link Entity Entity Entity Fig 9: A Network structure
Possible representation • An example of the compact disc ordering database using a network structure is shown in figure 10. • The entities (ITEM-DESCRIPTION and ORDER-DETAILS) are connected by network links (STATUS-LINK). • Updating record (such as correcting a person’s credit-card number) is easier than in hierarchical structure, because order record (10784 for “MacRae”) appears only once. It is also possible to insert records for customers who have not yet placed orders (for instance, if they wish to be on a catalog mailing list). The appropriate ITEM-DESCRIPTION can be added ata later date, when the order is placed.
STATUS-LINK ITEM-DESCRIPTION Shipped5/12 Shipped5/14 Inprocess Inprocess Backordered Shipped5/12 Shipped5/12 ORDER-DETAILS Fig 10:Network Structure
Possible representation Our survey of some storage structures permitted by the stored record interface in now complete. In conclusion we should perhaps points out that there is no such thing as a "best" storage structure. What is "best" depend on what is important to the enterprise (organization). It is the responsibility of the DBA to balance large conflicting requirements in choosing a storage structure.
Possible representation The consideration that must be taken into account include so many pointed such as: • Retrieval performance. • The difficulty of applying change. • The amount of storage space available. • The ease with which the database may be reorganized. • Desired frequency of such reorganization. • Problem of recovery. • And so on.
Summary: In this learning sequence, we discussed the following topic: - Three possible representations for some sample data.