SQL Programming Manual for TAL
Program Compilation and Execution
HP NonStop SQL Programming Manual for TAL—527887-001
5-34
Estimating Program Size
Caution. The system allocates real memory in 2 KB pages. If an SQL statement uses only
part of a page, the system allocates the entire page. Therefore, the real memory used by
embedded SQL statements can be larger than the figures shown in Ta bl e 5 -1 on page 5-33.
A program can encounter memory problems in these cases:
•
It contains a large number of embedded SQL statements.
•
It runs on a system with limited memory (for example, 16 MB or less).
•
It runs in a processor that is also running a large number of other programs.
To reduce the memory use in the extended data segment, follow these guidelines:
•
Declare only the host variables that your program actually requires.
•
Declare all host variables in one Declare Section if possible. The system allocates the host
variables contiguously in one or more pages, rather than allocating each host variable in a
separate page.
•
Execute SQL statements in listing order as often as possible. Thus, the SQL statements
can share many of the pages in the extended data segment.
•
As a last measure, use dynamic SQL statements. Using dynamic SQL statements can
reduce memory use; however, it also can degrade a program’s performance because of
the additional SQL run-time compilations.