|
Q and A
Asked and Answered
Q. What exactly do the terms plan and package mean in a DB2 UDB for Linux,
Unix, and Windows context? Is it possible to run an application with only a package?
Roger Sanders responds:
Each SQL statement must go through the DB2 optimizer before it can be executed. The optimizer generates a data access plan (which is used to locate the data when a query is executed), and the access plan is stored in a package. The package itself is stored in the system catalog if the SQL statement is a static statement coded in an application, or in the package cache, if the SQL statement is a dynamic statement.
You can view the access plan for one or more SQL statements with Explain. It's possible to run an embedded SQL application using only the package. When you precompile the application, a package is created containing access plans for the SQL statements coded in the application. That package is stored in the database that was used to precompile the application. You can also precompile an application and have the access plan information stored in an external file, which can then be bound to any database you want to use the application with; the binding process generates the package and stores it in the database specified this is referred to a deferred binding.)
For more information, look at the PRECOMPILE and BIND commands in the DB2 Command Reference.
To find out how plans and packages work in DB2 UDB for z/OS or OS/390, read
"Programs and Packages, Plans and Collections"
by Robert Catterall.
See a
complete archive of reader/author Q&As
.
|