Docsity

database design overview, Lecture notes of Database Management Systems (DBMS)

Partial preview of the text

Download database design overview and more Lecture notes Database Management Systems (DBMS) in PDF only on Docsity!

Database Design

Sameea Ashraf University of the Punjab Punjab University College of Information Technology (PUCIT)

Database Design

It is a process of creating a design that will

support the organization’s objectives for

the required database system.

• There are two main approaches to

database design:

a) Bottom-up Approach

b) Top-down Approach

Top-down Approach (design by analysis)

  • (^) It starts with a number of groupings of attributes into

relations that exist together naturally, for example, an

invoice.

  • (^) The relations are then analyzed through

normalization.

  • (^) One may start with the development of ER model,

beginning with the identification of entities and

relationships between the entities, which are of

interest to the organization.

  • (^) The ER model is then transformed into a set of

relations using the appropriate rules for conversion.

Database Design

Phases of Database Design

Database design is an iterative process.

• Database design is made up of three

main phases:

1.Conceptual database design

2.Logical database design

3.Physical database design

Steps of Conceptual database design

  1. Identify entity types
  2. Identify relationship types
  3. Identify and associate attributes with entity or relationship types
  4. Determine attribute domains
  5. Determine candidate, primary, and alternate key attributes
  6. Consider use of enhanced modeling concepts (optional step)
  7. Check model for redundancy
  8. Validate conceptual data model against user transactions
  9. Review conceptual data model with user Phases of Database Design

Logical database design

  • (^) The process of constructing a model of the data

used in an enterprise based on a specific data

model.

  • (^) The logical data model is based on the target

model for the database, such as the relational

data model.

  • (^) The technique of normalization is used to test

the correctness of the logical data model.

Phases of Database Design

Physical database design

  • (^) The process of producing the description of the

database on the secondary storage; it describes

the base relations, file organizations, and

indexes used to achieve efficient access to the

data.

  • (^) Physical database design is tailored to a specific

DBMS.

  • (^) Logical database design is concerned with

what, physical database design is concerned

with how.

Phases of Database Design

Steps of Physical database design

1. Design base relations

2. Design representation of derived data

3. Design general constraints

4. Design file organization and indexes

5. Coding and Compression Techniques

6. Analyze transactions

7. De-normalization

8. Partitioning

9. Estimate disk space requirements

10. Design user views

11. Design security mechanism

Phases of Database Design

Derived data

  • (^) Whether a derived attribute is stored in the database or calculated every time it is needed is a tradeoff. The designer should calculate: - (^) The additional cost to store the derived data and keep it consistent with operational data. - (^) The cost to calculate each time it is required.
  • (^) The less expensive option is chosen subject to performance constraints.
  • (^) Derived attribute should be stored when:
    • (^) A frequent query is made against it.
    • (^) The DBMS’s query language cannot easily calculate the derived attribute. Physical Database Design

Design general constraints

  • (^) Constraints are designed to enforce business

rules and the correctness of data.

  • (^) The constraints defined at physical database

design can greatly reduce the programming

effort at the application level.

  • (^) We can introduce constraints such as DEFAULT

value, CHECK constraint, Referential Integrity,

database triggers etc.

Physical Database Design

Coding and Compression Techniques

  • (^) Coding techniques are useful for compression of data values, by replacing those data values with the smaller sized codes.
  • (^) Consider the following relation:
  • (^) EMP (EmpNo, Ename, Job, City,…….)
  • (^) If we have large number of records, then the wastage of small amount of space in each record can lead to loss of huge amount of data storage space.
  • (^) To avoid the above problem, we can use the following relations: - (^) EMP (EmpNo, Ename, JobCode, CityCode,…….) - (^) Job (JobCode, JobTitle) - (^) City (CityCode, CityName) Physical Database Design

Analyze transactions

  • (^) To understand the functionality of the transactions that will run on the database and to analyze the important transactions.
  • (^) For efficient database design, it is necessary to have knowledge of the transactions or queries that will run on the database. It includes the identification of frequent transactions, the transactions that are critical, peak load time etc.
  • (^) We use the transaction information to select appropriate file organizations and indexes.
  • (^) For transaction analysis, we can use a transaction / relation cross- reference matrix, which shows the operation a transaction performs on a certain relation.
  • (^) The above information will be used to determine the indexes that are required. Physical Database Design

Denormalization

  • (^) Denormalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.
  • (^) A fully normalized database schema can fail to provide adequate system response time due to excessive table join operations.
  • (^) Denormalization results in combining two relations into one relation. More specifically, in this step, we consider duplicating certain attributes or combining relations together to reduce the number of joins required to perform a query.
  • (^) As a general rule of thumb, if performance is unsatisfactory and a relation has a low update rate and very high query rate, denormalization may be a viable option. Physical Database Design

Denormalization

  • (^) Denormalization Situation 1:
  • (^) Many to many binary relationships mapped to three relations.
    • (^) EMP (empID, eName, job, Sal)
    • (^) PROJ (pjId, pjName)
    • (^) WORK (empID, pjId, dtHired)
  • (^) By de-normalizing these relations, we merge the WORK relation with PROJ relation. In this case it is violating 2NF and anomalies of 2NF would be there, but there would be only one join operation involved by joining two tables, which increases the efficiency. - (^) EMP (empID, eName, job, Sal) - (^) PROJ (pjId, pjName, empId, dtHired) Physical Database Design