2.1 Optimized Logical Design: Achelor S Egree IN Nformatics Ngineering

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

BACHELOR'S DEGREE IN INFORMATICS ENGINEERING Academic course: 2012/2013 Course: 2 Subject: Files and Databases

Lab Work 3: Template for Labwork Report

Student: Adrin Gil -100293146

1 Introduction
When observing the original design, we can appreciate it has several lacks. First of all, logically it's not optimized, as the general unit is not in bytes. Also, the physical-logical design is far from being the best one, which has a very low density as we will see. Therefore, we should improve it as follows.

2 Analysis & Design


2.1 Optimized logical design The first thing we can notice fro mthe logical design provided, is that there is not an uniform variable type to store the different elements. This results in a lack as there does exist one which is better for every case: the bytes. From the different fields it should be highlighted that the specialitis eare optional and can be up to 5, and that as we know that a DNI is formed by 8 numbers and a verification letter, we can later improve it. The original types of variable char and type should be passed to bytes, where 2 chars is 1 byte and 1 number is 1 byte. IF the number of chars is odd, we always take the upper bound. Therefore, we obtain: Physician:= ( College_number B(6), First Name B(20), First Surname B(8), Second Surname B(8), DNI B(5), Pager B(9), Specialty ( Name B(25), Description B(75) )* )

BACHELOR'S DEGREE IN INFORMATICS ENGINEERING Academic course: 2012/2013 Course: 2 Subject: Files and Databases
Lab Work 3: Template for Labwork Report

Student: Adrin Gil -100293146 2.2 Optimized physic-logical design Now, starting from the optimized logical design, it should be analyzed the type of data stored in each variable. We will divide this into fixed size variables (College number, DNI, Pager), variable size variables (First name, First surname, Second surname, Name, Description ) and optional variables (Speciality). Departing from this, all variable length variables will have a length mark, the fix length variables which can be optimized analyzing it's data will be also optimized and finally optional variables will have an existence mark. From the fix length variables, the only ones which could be optimized are the ones formed by numbers, that is DNI (8 numbers plus a letter) and Pager. In order to do this, we must see if changing from base 10 to base 256 due to the format (and taking into account the original size), we get a more optimized structure than with the logical design.The operation that should be done is the logarithm base 256 of the worst case in both variables, that is to say: Pager:

DNI:

.log 256 (999999999)1 = .3.7371 = 4

.lo g 256 (99999999)1 + 1 = .3.3221 + 1 = 5

We can now conclude that for DNI no bytes are saved, while there are 4 bytes saved for page number. The final model is the following: Physician:= ( College_number B(6), first_name_length B(1), First Name B(first_name_length), first_surname_length B(1), First Surname B(first_surname_legth), second_surname_length B(1), Second Surname B(second_surname_length), DNI B(5), Pager B(4),

BACHELOR'S DEGREE IN INFORMATICS ENGINEERING Academic course: 2012/2013 Course: 2 Subject: Files and Databases
Lab Work 3: Template for Labwork Report

Student: Adrin Gil -100293146 exist_speciality B(1), ( name_length B(1), Name B(name_length), description_length B(1) Description B(description_length) )exist_speciality ) second_surname_length Data Element College_number h First Name first_na first_name_length me_lengt h 1 first_surname_length Length 1 4 Max 2 1 Length 1 Size (bytes) Mean Mark Type Size

first_name_lengt 1

first_surname_len 1 gth First_surname first_sur name_le ngth 1

second_surname_ length Second_surname

Length

second_s second_surname_length urname_ length 5 4 1 1 name_le ngth 1 descripti on_lengt h 3 2 1 1 name_length 1 description_length Length 1 Existence Length 1 1

DNI Pager exist_speciality name_length name description_lengt h Description

BACHELOR'S DEGREE IN INFORMATICS ENGINEERING Academic course: 2012/2013 Course: 2 Subject: Files and Databases
Lab Work 3: Template for Labwork Report

Student: Adrin Gil -100293146

3 Physical Design: Base structure - Hash


As Hash structure, based on the statement hashed functions, I decided to introduce as hashed function an ASCII value coming from the mod96 (the 96 printable characters) of the sum of the ASCII value of all the letters inside each field. Therefore, it is formed by 4 characters: name+surname1+surname2+speciality. It can occur collisions, but taking into account the size of the hash key it won't be a great number. Finally, it is not neccesary to search with the 4 values, it is enough with a single one with charAt comparation. Therefore, we could even make other searchs such as entering just Surname1.

You might also like