Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
1 Ans: The DB2 compiler reviews object statistics, gathered by the RUNSTATS command, to determine the best way to optimize the request. Absent or outdated statistics can cause the SQL compiler to make poor
optimization decisions about index access, join method and data refetching.
Object relationships and dependencies are also important to SQL tuning. For example, a trigger that executes every time a row is inserted could cause insert statements that take an unusual amount of time to process. Without a complete picture of the objects involved with a SQL
statement, tuning efforts may be dedicated to the wrong area.
2 Ans: views are stored in SYSVIEWS table.
select * from SYSIBM.SYSVIEWS; will show a list of views
An alias can be defined for an object that does not exist at the time of the definition. If it does not exist, a warning is issued (SQLCODE 01522).
However, the referenced object must exist when a SQL statement containing the alias is compiled, otherwise an error is issued (SQLCODE 52004).