Physical Data Independence

 <  Day Day Up  >  

The notion of optimizing data access in the DBMS, a piece of system software, is one of the most powerful capabilities of DB2. Access to DB2 data is achieved by telling DB2 what to retrieve, not how to retrieve it. Regardless of how the data is physically stored and manipulated, DB2 and SQL can still access that data. This separation of access criteria from physical storage characteristics is called physical data independence. DB2's optimizer is the component that accomplishes this physical data independence.

If indexes are removed, DB2 can still access the data (albeit less efficiently ). If a column is added to the table being accessed, the data can still be manipulated by DB2 without changing the program code. This is all possible because the physical access paths to DB2 data are not coded by programmers in application programs, but are generated by DB2.

Compare this with older, legacy data manipulation mechanisms (such as VSAM, IMS, and flat files), in which the programmer must know the physical structure of the data. If there is an index, the programmer must write appropriate code so that the index is used. If the index is removed, the program will not work unless changes are made. Not so with DB2 and SQL. All this flexibility is attributable to DB2's capability to optimize data manipulation requests automatically.

NOTE

Physical data independence is the primary reason that it is a best practice to put as much work as possible into SQL statements, instead of into host program logic. When data statistics and characteristics change, DB2 can formulate another access path for the SQL; programmers are required to rewrite host language code to change access requirements. Heed this advice or suffer the peril of poor performance and extra programming.


 <  Day Day Up  >  


DB2 Developers Guide
DB2 Developers Guide (5th Edition)
ISBN: 0672326132
EAN: 2147483647
Year: 2004
Pages: 388

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net