Hi, H2 SQL statements containing a lof of UNION ALL expressions (top level) consume a lot of memory, especially when the "unioned" SELECT queries are quite large (like for generated statement that we use). According to JProfiler, this is caused because the H2 SelectUnion objects reference each other in a row:
Currently, my workaround is a table function, that receives the SQL statement texts to union. The table function returns a result set that executes all queries in a row and creates the next resultset when a previous one was completely read. The runtime of both union all versions is equal, but using the table function, only the single statements must fit into memory, but not the full cascade of SelectUnion objects. Maybe there is a possibility to updates H2's handling of UNION ALL statements so that they require less memory? Kind regards Christoff Schmitz ================================================================================================================ Disclaimer The information contained in this e - mail and any attachments ( together the "message") is intended for the addressee only and may contain confidential and/or privileged information. If you have received the message by mistake please delete it and notify the sender and do not copy or distribute it or disclose its contents to anyone. FINARIS Financial Software Partner GmbH, Sömmerringstr. 23, 60322 Frankfurt/Main, Germany Registered at Frankfurt/Main, HRB 52873, Managing Directors: Dipl. Inf. Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl ================================================================================================================ -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.