Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Welcome: To the forth learning sequence “ Possible representation (1) “ Recap : In the previous learning sequence, we discussed the basic definitions.

Similar presentations


Presentation on theme: "1 Welcome: To the forth learning sequence “ Possible representation (1) “ Recap : In the previous learning sequence, we discussed the basic definitions."— Presentation transcript:

1 1 Welcome: To the forth learning sequence “ Possible representation (1) “ Recap : In the previous learning sequence, we discussed the basic definitions of Data base subject. Present learning: We shall explore the following topics: - Regular organization. - Factoring out the CITY value. - Indexing on city. - Combination the previous representations.

2 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 3 Possible representation The sample data is consists of information about five suppliers; for each supplier we wish to record a: Supplier number (S#), a supplier name (SNAME), a status value (STATUS), and location (CITY).

4 4 Possible representation 1- Note that the (Figure1) actually a very simple conceptual model of the data. S#SNAMESTATUSCITY S1Smith20London S2JOHNS10Paris S3BLACKE30Paris S4CLARK20London S5ADAMS10Athens Fig 1: sample data regular organization

5 5 Possible representation The representation in fig 1 (file containing five stored record occurrence) has the advantage of simplicity but would probably be inadequate for various reasons in a realistic situation. Suppose, for example we have (10.000) suppliers instead of just of five, but that they were located in only (10) different cities.

6 6 Possible representation 2- If we assume that the amount of storage required for a pointer is less than that required a city name, the representation illustrated in fig2 will clearly save some storage space in such a situation.

7 7 Possible representation S#SNAMESTATUSCITY POINTER S1Smith20 S2JOHNS10 S3BLACKE30 S4CLARK20 S5ADAMS10 CITY Athens London Paris Supplier file City file Fig2: Factoring out the CITY value

8 8 Possible representation S#SNAMESTATUSCITY POINTER S1Smith20 S2JOHNS10 S3BLACKE30 S4CLARK20 S5ADAMS10 CITY Athens London Paris Supplier file City file Fig2: Factoring out the CITY value

9 9 Possible representation Here we have two stored files, a supplier file and a city file, with pointers out of the former into the later. These pointers are Stored Record Addresses (SRAs). The only advantage of this representation (compared with the previous one) is the saving in space. A request to find all properties (attributes) of a given supplier (entity) will require at least one more access than before.

10 10 Possible representation 3- A request to find all suppliers (entities) in a given CITY will involve several more access. If such a case requested and it is an important one. The DBA may choose the alternative representation shown in fig3.

11 11 Possible representation S#SNAMESTATUS S1Smith20 S2JOHNS10 S3BLACKE30 S4CLARK20 S5ADAMS10 CITYSUPPLEIR POINTER Athens London Paris City file Supplier file Fig3: Indexing on city

12 12 Possible representation S#SNAMESTATUS S1Smith20 S2JOHNS10 S3BLACKE30 S4CLARK20 S5ADAMS10 CITYSUPPLEIR POINTER Athens London Paris City file Supplier file Fig3: Indexing on city

13 13 Possible representation Here again we have two stored file. A supplier file and a city file but this time there are pointers out of the later city into the firmer supplier. Each city stored record occurrence contains pointers to all corresponding supplier stored record occurrence.

14 14 Possible representation It should be obvious that the last representation of data (factoring out the city) is better than the previous figure (Indexing on city) for queries asking for all supplier in a given city but worse for queries asking for all attributer of given supplier. Here we conclude that representation of data is strongly dependent on the queries (access) asked by the system user.

15 15 Possible representation Also it is worth to mention, that it is the Data Base Management System (DBMS), not the Access Method that maintain the pointers; the access method is only responsible for assigning a unique stored record address (SRA) as it was mentioned before. The interesting thing about the previous representation is that the CITY file is an index to the SUPPLIER file (an index controlled by the DBMS, not by the access method).

16 16 Possible representation 4- To obtain the advantages of each of the previous two representation (at the cost of repairing slightly more storage space and probably more significant having more pointed maintenance to do when changes occur); we can have the following representation for data (fig 4).

17 17 Possible representation Athens. London..Paris.. S1Smith20. S2Jones10S3Black30S4Clark20S5Adams30 Fig 4: Combination the previous Fig2@3

18 18 Possible representation Athens. London..Paris.. S1Smith20. S2Jones10S3Black30S4Clark20S5Adams30.. Fig 4: Combination the previous Fig2@3

19 19 Possible representation Athens. London..Paris.. S1Smith20. S2Jones10S3Black30S4Clark20S5Adams30.... Fig 4: Combination the previous Fig2@3

20 20 Possible representation Athens. London..Paris.. S1Smith20. S2Jones10S3Black30S4Clark20S5Adams30.... Fig 4: Combination the previous Fig2@3

21 21 Summary: In this learning sequence, we discussed the following topic: - Four possible representations for some sample data.

22 22 END


Download ppt "1 Welcome: To the forth learning sequence “ Possible representation (1) “ Recap : In the previous learning sequence, we discussed the basic definitions."

Similar presentations


Ads by Google