The example below runs less than a second. If I change connection parameter to 
LAZY_QUERY_EXECUTION=1 then it takes forever.


I tested with both 1.4.196 and 1.4.197. The same result.


@Test
public void subquery() throws Exception {
    Class.forName("org.h2.Driver");
    try (Connection conn = 
DriverManager.getConnection("jdbc:h2:mem:;LAZY_QUERY_EXECUTION=0")) {
        try (Statement stat = conn.createStatement()) {
            final int ROWS = 100000;
            stat.execute("CREATE TABLE ONE(X INTEGER , Y INTEGER )");
            try (PreparedStatement prep = conn.prepareStatement("insert into 
one values(?,?)")) {
                for (int row = 0; row < ROWS; row++) {
                    prep.setInt(1, row / 100);
                    prep.setInt(2, row);
                    prep.execute();
                }
            }
            String s1 = "SELECT COUNT (*) from one where x in ( select y from 
one where y < 100)";
            try (ResultSet rs = stat.executeQuery(s1)) {
                rs.next();
                Assert.assertEquals(rs.getInt(1), 10000);
            }
        }
    }
}

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to