16.20 - Setting Memory Limits - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

Advanced SQL Engine
Teradata Database
Release Number
April 2020
Content Type
Programming Reference
Publication ID
English (United States)
Last Update

The ScriptMemLimit field in the cufconfig Globally Distributed Object (GDO) is used to limit the memory that is made available on every AMP during a single call to SCRIPT. The default limit is 32 MB, but this is typically inadequate for external language execution, because the AMP holds in memory all the libraries and data loaded when a language script instance executes on the AMP. Recommended values for the ScriptMemLimit field are in the range of 1 - 3 GB (1073741824 to 3221225472 bytes). Lack of memory might result to an explicit error during SCRIPT execution; more often, however, it may manifest as unrelated errors that can be difficult to interpret. To use the maximum available memory, set ScriptMemLimit to 0 (nonzero value recommended to retain a consumption limit per AMP).

The following example assumes default settings on a system, and shows how to check and change the ScriptMemLimit value to 1 GB.

  1. Connect as root user to the target system, and use a Bash shell command line.
  2. Inspect the current cufconfig parameters and their values by the command:
    /usr/tdbms/bin/cufconfig -o
  3. Locate the ScriptMemLimit field in the output listing. It should appear among the output as follows:
       ScriptMemLimit: 33554432
    This means the ScriptMemLimit size is 33554432 bytes / 1024 (KB/byte) / 1024 (MB/KB) = 32 MB.
  4. To change this value to 1 GB, create a text file in the /tmp directory of every node on the server, so that this file contains the line: ScriptMemLimit: 1073741824.
    psh "printf ScriptMemLimit: 1073741824' > /tmp/ccChange.txt"
    Memory size must be specified in bytes.
  5. Invoke the cufconfig utility to accept the new setting by the following command:
    psh /usr/tdbms/bin/cufconfig -i -f /tmp/ccChange.txt
  6. Inspect the result using the following command:
    /usr/tdbms/bin/cufconfig -o
Changes in the ScriptMemLimit field take effect the following time an STO query is executed.