Progress
Programming
Handbook
Differences Between Temporary and Work Tables
Temporary tables and work tables have the following differences:
- When you define temporary tables with the LIKE option and do not explicitly specify indexes for them, they inherit index information from the database table. Work tables do not have index support.
- While temporary table records are stored in a temporary database on disk, work table records are stored in memory. Note that for a relatively small application with a sufficiently large buffer allocation, Progress does not have to perform any disk I/O for temporary tables. To specify buffer size for temporary tables, use the –Bt parameter.
- The performance of a temporary table is comparable to the performance of a database table. If you select the NO–UNDO option, UPDATE performance increases for temporary tables. If you do not use NO–UNDO, then changes made to the temporary table during a transaction are logged to the local before image (LBI) file.
- The FIND statement for temporary tables uses the same cursor concept and choose-index logic that are used for regular database tables. When a temporary table record is created, its logical position in the table depends on the values of its key fields. Its logical position in the table can be changed by changing the key values.
- Because temporary tables have indexes similar to regular database tables, they can perform fast sequential and random access to temporary table records using one or more indexes. Since work tables have no index support, all record access is performed with a sequential search.
- If you use the Record phrase OF option to join a work table, the other table in the join (database or temporary) must have a unique index for the common fields. For more information on joins and the OF option, see Database Access."
- You can pass temporary tables (but not work tables) as parameters to procedures. In fact, if you want to call a Progress AppServer passing it a table of data, you must pass the table of data as a temporary table. There is no other way. For more information on Progress AppServers, see Building Distributed Applications Using the Progress AppServer . For more information on temporary tables as parameters, see the "Temporary Tables As Parameters" section in this chapter.
The following program illustrates using a temporary table for non-database data:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |