EasyManua.ls Logo

HP NonStop SQL/MP User Manual

HP NonStop SQL/MP
331 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #298 background imageLoading...
Page #298 background image
Memory Considerations
HP NonStop SQL/MP Programming Manual for C—429847-008
B-4
Avoiding Memory Stack Overflows
The system allocates real memory in 16 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 Table B-2 on
page B-3.
A program can encounter memory problems in these situations:
ï‚·
The program contains a large number of embedded SQL statements.
ï‚·
The program runs on a system with limited memory (for example, 16 MB or less).
ï‚·
The program runs in a CPU 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.
ï‚·
Run 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 can also degrade a program’s performance
because of the additional SQL run-time compilations.
Avoiding Memory Stack Overflows
To avoid memory stack overflows for most SQL statements, the SQL executor needs at
least 3000 words of available stack space. To calculate the approximate stack space
that should be available to run an SQL statement, use this formula:
Stack Space (words) = 3000 +
300 * ( number of referenced tables - 3 )
For example, using this formula, an SQL statement that refers to five tables needs
approximately 3600 words of stack space:
Stack Space (words) = 3000 + ( 300 * (5-3) )
= 3600
The SQL executor handles a stack overflow caused by an SQL statement as follows:
ï‚·
Less than 1024 words of stack space are available. (The limit of 1024 words is an
arbitrary number that is used to prevent problems for existing applications, and
might be increased in a future RVU.)
If there is enough stack space available to call an error handling routine, the SQL
executor returns SQL error 8003. If there is not enough stack space to call the
routine, the executor abends without returning a message.
ï‚·
At least 1024 words of stack space are available.

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the HP NonStop SQL/MP and is the answer not in the manual?

HP NonStop SQL/MP Specifications

General IconGeneral
PlatformHP NonStop Servers
Data ModelRelational
SQL StandardANSI SQL
Concurrency ControlMulti-Version Concurrency Control (MVCC)
Fault ToleranceYes
High AvailabilityYes
CategoryDatabase Software
Initial Release1980s
Operating SystemHP NonStop OS
LicenseProprietary
TypeRelational Database Management System
Transaction ManagementACID Compliance
DeveloperHewlett Packard Enterprise

Summary

1. Introduction

Developing a C Program

Outlines the process of creating C programs with embedded SQL statements.

Dynamic SQL

Describes how to construct, compile, and run SQL statements at runtime.

2. Host Variables

3. SQL/MP Statements and Directives

4. Data Retrieval and Modification

Single-Row SELECT Statement

Retrieves a single row of data from tables or views into host variables.

Multirow SELECT Statement

Returns multiple rows from tables or views, one row at a time, using cursors.

INSERT Statement

Inserts one or more rows into a table or protection view using host variables.

Using SQL Cursors

Explains how to use named pointers to access sets of rows one at a time.

5. SQL/MP System Procedures

6. Explicit Program Compilation

Explicit Program Compilation

Outlines the general steps for compiling C programs with embedded SQL.

Developing a C Program in the Guardian Environment

Details C program development within the Guardian environment.

7. Program Execution

Required Access Authority

Specifies the access permissions needed to run NonStop SQL program files.

8. Program Invalidation and Automatic SQL Recompilation

Program Invalidation

Explains how SQL program files can become invalid due to changes or errors.

Automatic SQL Recompilation

Describes the run-time recompilation process invoked by the SQL executor.

9. Error and Status Reporting

10. Dynamic SQL Operations

Uses for Dynamic SQL

Identifies scenarios where dynamic SQL programs are beneficial.

Dynamic SQL Statements

Summarizes dynamic SQL statements usable in a C program.

11. Character Processing Rules (CPRL) Procedures

Appendix B: Memory Considerations

Avoiding Memory Stack Overflows

Provides guidelines to prevent stack overflows for SQL statements.

Related product manuals