Skip to content

DBAzine.com

Sections
Personal tools
You are here: Home » Blogs » Craig Mullins Blog » Craig Mullins: Perspectives on Database Management » Database Design: From Logical to Physical
DBAzine Updates
The best way for me to find out about site updates is:
RSS feeds
Browsing the site
Receiving email updates

[ Results | Polls ]
Votes : 121
 

Database Design: From Logical to Physical Database Design: From Logical to Physical

Recently I've posted blog entries about data modeling and metadata management, but it occurred to me that it might make sense to back up a little and discuss database design at a higher level.
Some of you may have read my recent posts on data modeling and metadata management. I'm sure many of you are "on board" with these topics and understand where I'm coming from on them. But there are probably some of you who have yet to embrace these disciplines in your career. As such, I though a short discourse on database design might be in order.

Database design is the process of transforming a logical data model into an actual physical database. As you create your data models, you are developing the lexicon of your organization’s business. Much like a dictionary functions as the lexicon of words for a given language, the data model functions as the lexicon of business terms and their usage. A logical data model is required before you can even begin to design a physical database.

Data modeling begins as a conceptual venture. The first objective of conceptual data modeling is to understand the requirements. A data model, in and of itself, is of limited value. Of course, a data model delivers value by enhancing communication and understanding, and it can be argued that these are quite valuable. But the primary value of a data model is its ability to be used as a blueprint to build a physical database.

When databases are built from a well-designed data model the resulting structures provide increased value to the organization. The value derived from the data model exhibits itself in the form of minimized redundancy, maximized data integrity, increased stability, better data sharing, increased consistency, more timely access to data, and better usability. These qualities are achieved because the data model clearly outlines the data resource requirements and relationships in a clear, concise manner. Building databases from a data model will result in a better database implementation because you will have a better understanding of the data to be stored in your databases.

Another benefit of data modeling is the ability to discover new uses for data. A data model can clarify data patterns and potential uses for data that would remain hidden without the data blueprint provided by the data model. Discovery of such patterns can change the way your business operates and can potentially lead to a competitive advantage and increased revenue for your organization.

Assuming that the logical data model is complete, though, what must be done to implement a physical database? The first step is to create an initial physical data model by transforming the logical data model into a physical implementation based on an understanding of the DBMS to be used for deployment. To successfully create a physical database design you will need to have a good working knowledge of the features of the DBMS including:

  • In-depth knowledge of the database objects supported by the DBMS and the physical structures and files required to support those objects.
  • Details regarding the manner in which the DBMS supports indexing, referential integrity, constraints, data types, and other features that augment the functionality of database objects.
  • Detailed knowledge of new and obsolete features for particular versions or releases of the DBMS to be used.
  • Knowledge of the DBMS configuration parameters that are in place.
  • Data definition language (DDL) skills to translate the physical design into actual database objects.
  • Armed with the correct information, you can create an effective and efficient database from a logical data model. The first step in transforming a logical data model into a physical model is to perform a simple translation from logical terms to physical objects. Of course, this simple transformation will not result in a complete and correct physical database design – it is simply the first step. The transformation consists of the following:

  • Transforming entities into tables
  • Transforming attributes into columns
  • Transforming domains into data types and constraints
  • To support the mapping of attributes to table columns you will need to map each logical domain of the attribute to a physical data type and perhaps additional constraints. In a physical database, each column must be assigned a data type. Certain data types require a maximum length to be specified. For example a character data type could be specified as CHAR(25), indicating that up to 25 characters can be stored for the column. You may need to apply a length to other data types as well, such as graphic, floating point, and decimal (which require a length and scale) types.

    But no commercial DBMS product supports relational domains. Therefore the domain assigned in the logical data model must be mapped to a data type supported by the DBMS. You may need to adjust the data type based on the DBMS you use. For example, what data type and length will be used for monetary values if no built-in currency data type exists? Many of the major DBMS products support user-defined data types, so you might want to consider creating a data type to support the logical domain, if no built-in data type is acceptable.

    In addition to a data type and length, you also may need to apply a constraint to the column. Consider a domain of integers between 1 and 10 inclusive. Simply assigning the physical column to an integer data type is insufficient to match the domain. A constraint must be added to restrict the values that can be stored for the column to the specified range, 1 through 10. Without a constraint, negative numbers, zero, and values greater than ten could be stored. Using check constraints you can place limits on the data values that can be stored in a column or set of columns.

    Specification of a primary key is an integral part of the physical design of entities and attributes. A primary key should be assigned for every entity in the logical data model. As a first course of action you should try to use the primary key as selected in the logical data model. However, multiple candidate keys often are uncovered during the data modeling process. You may decide to choose a primary key other than the one selected during logical design – either one of the candidate keys or another surrogate key for physical implementation. But even if the DBMS does not mandate a primary key for each table it is a good practice to identify a primary key for each physical table you create. Failure to do so will make processing the data in that table more difficult.

    Of course, there are many other decisions that must be made during the transition from logical to physical. For example, each of the following must be addressed:

  • The nullability of each column in each table
  • For character columns, should fixed length or variable length be used?
  • Should the DBMS be used to assign values to sequences or identity columns?
  • Implementing logical relationships by assigning referential constraints
  • Building indexes on columns to improve query performance
  • Choosing the type of index to create: b-tree, bit map, reverse key, hash, partitioning, etc.
  • Deciding on the clustering sequence for the data
  • Other physical aspects such as column ordering, buffer pool specification, data files, denormalization, and so on.
  • Summary

    A logical data model should be used as the blueprint for designing and creating a physical database. But the physical database cannot be created properly with a simple logical to physical mapping. Many physical design decisions need to be made by the DBA before implementing physical database structures. This may necessitate deviating from the logical data model. But such deviation should occur only based on in-depth knowledge of the DBMS and the physical environment in which the database will exist.

    This blog entry is, of course, just a broad overview of the many complex and intricate processes and procedures involved in logical and physical database design. If all you are doing today is creating databases at the physical level ("DDL jockying") then you'd be wise to start reading about and studying logical data modeling. Here are a few resources to consider:

    Data Modeling Essentials by Graeme Simsion and Graham C. Witt. This book provides a good, solid tutorial on data modeling from two of the foremost experts on the topic. It is useful for all levels (beginner to expert) of data modeling expertise.

    Beginning Relational Data Modeling by Sharon Allen with Evan Terry. This book offers a nice introduction to the topic of data modeling and is recommended for modeling novices.

    The Data Administration Newsletter. This fantastic web site offers a plethora of useful information on data modeling, metadata, and data stewardship issues. It is refreshed quarterly, so be sure to check it out the beginning of each new quarter.

    Good luck modeling your data!

    Monday, December 19, 2005  |  Permalink |  Comments (0)
    trackback URL:   http://www.dbazine.com/blogs/blog-cm/craigmullins/blogentry.2005-12-19.9143315590/sbtrackback
    Craig Mullins
    Data Management Specialist
    Bio & Writings
    Subscribe to my blog Subscribe to my blog
    « January 2006 »
    Su Mo Tu We Th Fr Sa
    1 2 3 4 5 6 7
    8 9 10 11 12 13 14
    15 16 17 18 19 20 21
    22 23 24 25 26 27 28
    29 30 31        
    2006-01-04
    10:52-10:52 Thoughts on Storage
    2006-01-09
    23:51-23:51 Database Performance and Row Size
    2006-01-11
    17:40-17:40 Predicting the Future? Don’t Believe a Word of it!
     
     

    Powered by Plone