29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.5.2 Indexes<br />

Third normal form<br />

In the third normal form, each non-key column is dependent upon the key column<br />

as in the second normal form, but is also independent of other non-key columns.<br />

In Table 2-1 we can see that the DeptName column is dependent on the DeptNo<br />

column. This table does not conform to the third normal form. If we update<br />

DeptName for one employee, it would not automatically update the DeptName<br />

column for other employees belonging to the same department<br />

Table 2-1 Table not in third normal form<br />

EMPNO(Primary Key) LastName DeptNo DeptName<br />

001 Brown 01 Support<br />

002 Smith 02 Sales<br />

To normalize this data to conform to the third normal form, we would create two<br />

tables. The first table, Table 2-2, contains the relation between the employee and<br />

the department number. The second table, Table 2-3, contains the relation<br />

between the department number and the department name. An update to the<br />

department name only needs to be done once.<br />

Table 2-2 Table in third normal form<br />

EMPNO(Primary Key) LastName DeptNo<br />

001 Brown 01<br />

002 Smith 02<br />

Table 2-3 Table in third normal form<br />

DeptNo(Primary Key) DeptName<br />

01 Support<br />

02 Sales<br />

One consideration when normalizing tables is that the more you normalize, the<br />

better it results in insert and update performance. However, it can slow down the<br />

query response time.<br />

Indexes are used to improve query performance. They provide a faster<br />

mechanism to search the database table for a particular column value(s) and<br />

avoid expensive and slower table scans. Columns of a table that are often used<br />

in search clauses are prime candidates for indexes. The downside of indexes is<br />

that they take up disk space and slow execution of insert and update statements.<br />

38 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!