Db2 LUW Global Temporary Table Memory Leak During Hibernate Pagination
0 reputation · 28 Mar 2025, 04:28 UTC
Db2 LUW Global Temporary Table Memory Leak During Hibernate Pagination
The Db2 LUW global temporary table (GTT) scope, defined as statement or transaction, is intended to release memory after statement completion, yet Hibernate's JOIN FETCH pagination may retain rows beyond the expected cleanup window.
When large result sets are processed with setFirstResult/setMaxResults, the combination of GTT row persistence and potential JDBC driver delays in flushing the temporary data can lead to unbounded memory consumption in the JVM, a behavior not clearly documented for DB2 11.5 and later.
What exact conditions cause the GTT cleanup to be delayed or ineffective, and how can the memory impact be reliably measured without affecting production workloads? Which JDBC driver versions and DB2 configuration settings are known to resolve the observed memory growth?