SQL Stack Size (-SQLStack)

Use SQL Stack Size (-SQLStack) to change the size of the SQL stack (an internal memory area used by SQL program modules) in kilobytes for each thread or connection created by the SQL Server process. . Use the command line to change the value of -SQLStack.

Operating system and syntax UNIX / Windows -SQLStack n
Use with Maximum value Minimum value Single-user default Multi-user default
SQL System Dependent 256 1000 System dependent
n
The size of the stack in Kilobyte units.

The stack is used to store the context of function calls and local variables. In most cases, the default setting of 1 MB is sufficient. However, certain SQL queries may require significantly more stack space. For example, a tool-generated or poorly written SQL query that includes multiple nested scalar functions may trigger deep recursion within the SQL Server process, potentially exhausting the stack limit. Adjusting the -SQLStack value may be necessary in environments where such queries are common.

-SQLStack value may be necessary in environments where such queries are common.

The SQL Stack Size (-SQLStack) parameter may be modified while your database is online using PROMON or through the _DbParams VST. This change will only take effect on the primary broker and its newly spawned servers.