TEMP DB RAM not freed after statement execution

Details

Detail name Value
Changelog number 30676
Type Bug
Status Resolved
Affected versions Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0, Exasol 2026.1.0
Fix versions Exasol 2025.1.17
Resolution Date 2026-11-12

Description

In some situations the system creates so-called hidden columns, for instance when using an expression in ORDER BY clauses where the ORDER BY expression is not in the select list, e.g.

SELECT A FROM B ORDER BY FALSE

In the case when a subselect using such columns is materialized it is possible that the temporary data used by the subselect is not freed upon query completion, but stays occupied until the end of the transaction. This in turn leads to increased DBRAM usage until the end of the transaction.
The following python snippet reproduces this bug:

conn = pyexasol.connect(
    dsn=dsn,
    user=user,
    password=password,
    encryption=True,
    autocommit=False
)

print("Setting up...")
conn.execute("ALTER SESSION SET QUERY_CACHE= 'OFF'")
conn.execute("ALTER SESSION SET SESSION_TEMP_DB_RAM_LIMIT='10G'")
conn.execute("ALTER SESSION SET PROFILE='ON'")
conn.execute("CREATE SCHEMA IF NOT EXISTS test")
conn.execute("CREATE OR REPLACE TABLE test.t(c VARCHAR(30))")
conn.execute("INSERT INTO test.t SELECT REPEAT('X',30) FROM VALUES BETWEEN 1 AND 5e7")

try:
    stmt = conn.execute("SELECT c FROM test.t LIMIT 1")
    for i in range(1, 10):
        print(f"Running query {i}...")
        stmt = conn.execute("SELECT c FROM test.t ORDER BY TRUE LIMIT 1")
        stmt.close()
except Exception as e:
    print(e.message)  # Here it will fail after a few iterations with TEMP_DB_RAM violating the session limit

Workaround

Ending the transaction (via commit or rollback) frees the TEMP DB RAM

Fix

The TEMP DB RAM is freed immediately.