IBM Db2 LUW Global Temporary Table Scope and Hibernate Pagination Behavior
0 reputation · 10 Aug 2022, 05:05 UTC
Problem Statement
Global temporary tables in IBM Db2 LUW can have session-specific or transaction-specific scope, which affects how query plans are cached and reused. When Hibernate generates paginated queries using setFirstResult/setMaxResults, the interaction between temporary table scope and pagination logic may produce inconsistent SQL or execution plans across different Db2 versions.
Key Constraints
- Db2 LUW behavior varies between versions 10.5, 11.1, and 11.5+
- Hibernate's Db2 dialect may not fully account for temporary table scope semantics
- Query plan caching may produce inconsistent results when temporary table definitions change
Unresolved Questions
Does the session vs. transaction scope of global temporary tables in Db2 LUW cause Hibernate's setFirstResult/setMaxResults pagination to generate different SQL or execution plans? If so, how can applications reliably predict and test pagination behavior across different Db2 versions when using temporary tables?