Transcript S6

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.
1
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.
2
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).
3
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 and
name
4
Possible representation
Athens
London
Paris
Fig 7: Hierarchical Organization
5
Possible representation
Athens
S5
London
Paris
Adams
Fig 7: Hierarchical Organization
6
Possible representation
Athens
S5
London
Adams
Paris
S1
Smith
S4
Clark
Fig 7: Hierarchical Organization
7
Possible representation
Athens
S5
London
Adams
Paris
S1
Smith
S2
Jones
S4
Clark
S3
Blake
Fig 7: Hierarchical Organization
8
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.
9
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.
10
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.
11
Possible representation
0
5
S200
9
1
S300
Jones
20
10
S400
2
Blake
Paris
30
6
S500
3
4
Paris
7
Adams
30
8
Athens
11
Clark
20
London
Fig 8: A Hash-addressing Organization
12
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.
13
Possible representation
Entity
Entity
Link
Link
Link
Entity
Entity
Entity
Fig 9: A Network structure
Link
14
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 at a later date, when the order is placed.
15
STATUS-LINK
ITEM-DESCRIPTION
Shipped5/12
B235
Guys and Dotts
8.99
B521
My Fair Lady
6.99
Shipped5/14
Inprocess
B894
42 street
10.99
B992
A Chorus Line
10.99
Inprocess
Backordered
Shipped5/12
10784
MacRae
G
2314Curly Circle
Lincoin
NE
45-4654-76
10796
Jones
S
34Dream Lane
Oklahama
OK
45-9876-74
11821
Preston
R
1003Madison Ave.
River City
IA
34-7642-64
12845
Channing
C
454Hammonia St.
NewYork
NY
34-0876-87
11872
Kittey
R
765Dulcines Drive
Lamansha
CA
65-8798-87
Shipped5/12
Fig 10:Network Structure
ORDER-DETAILS
16
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.
17
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.
18
Summary: In this learning sequence, we discussed
the following topic:
- Three possible representations for some sample
data.
19
END
20