Progress
Programming
Handbook
Using Database, Temporary, and Work Tables
Database tables provide data storage in a permanent database and can be accessed by single or multiple users. However, if you want to process data for the duration of a procedure in complete privacy, use temporary tables or work tables. Temporary tables have several advantages over work tables:
- Temporary tables perform like database tables.
- Because temporary tables have indexes, you can use statements that require indexes, such as FOR EACH or a simple FIND.
- Temporary tables are not limited to the value of the buffer size defined by the –Bt parameter. Progress stores any overflow of temporary table records to disk. Work tables, however, are limited by the amount of memory available on your system.
- You can pass a temporary table as a parameter when you call a procedure. In fact, if you want to call a Progress AppServer passing it a table of data, you must pass the 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.
There are some situations where you might want to use work tables:
- If you want to process a small number of records (for example, 50 or less) and you do not have to order or sort the data.
- If your existing applications use work tables and you want to maintain compatibility with these applications. Note that if you rewrite existing applications (that use work tables) so that they now use temporary tables, remember that temporary tables inherit index layouts defined for the LIKE table. If you do not want this result, you must define your own indexes.
Table 15–1 compares database tables, temporary tables, and work tables.
The following sections describe in greater detail the similarities and differences between temporary tables and work tables, as well as how to define indexes for temporary tables.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |