Global Temporary Tables

There are occasions when a table does not need to exist for a long period of time. For example, a table may be needed to act as a staging area for data for use by a program. Temporary tables can be used to accommodate this. There are two types of temporary tables: created or declared.

Created Temporary Tables

Created temporary tables (CTTs) can help improve performance in many different ways. Any time there is repetitive SQL being used to return a result set, producing exactly the same result each time, a CTT might provide benefit. A subquery that is used more than once is a prime example. It would be better to issue the subquery once, storing the result set rows in the CTT, and use the CTT in subsequent subqueries. The ...

Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.