"values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
rs.next();
String rts = rs.getString(1);
// Now verify the correct runtimeStatistics output
RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rts);
// print out the full stats if derby.tests.debug is true
println("full stats: \n" + rtsp.toString());
// the essentials are getting checked as per the comments
// above. If further checking is needed, uncomment more lines.
rtsp.assertSequence(
new String[] {
"Hash Join ResultSet:",
//"Left result set:",
//"_Sort ResultSet:",
//"_Source result set:",
//"__Project-Restrict ResultSet (7):",
//"__Source result set:",
//"___Nested Loop Join ResultSet:",
//"___Left result set:",
//"____Project-Restrict ResultSet (5):",
//"____Source result set:",
//"_____Table Scan ResultSet for T1 at read committed " +
// "isolation level using share row locking chosen " +
// "by the optimizer",
//"______Bit set of columns fetched={0}",
//"______Scan type=heap",
//"___Right result set:",
//"____Table Scan ResultSet for T2 at read committed " +
// "isolation level using share row locking chosen " +
// "by the optimizer",
//"_____Bit set of columns fetched=All",
//"_____Scan type=heap",
//"______Operator: =",
"Right result set:",
"_Hash Table ResultSet (13):"
//"_Source result set:",
//"__Sort ResultSet:",
//"__Source result set:",
//"___Project-Restrict ResultSet (12):",
//"___Source result set:",
//"____Hash Join ResultSet:",
//"____Left result set:",
//"_____Table Scan ResultSet for T3 at read committed " +
// "isolation level using share row locking chosen " +
// "by the optimizer",
//"______Bit set of columns fetched=All",
//"______Scan type=heap"
//,
// after this, there's something peculiar with the
// 'Right result set' line output, and this RuntimeStatisticsParser
// method cannot find any further matches...
//"___Right result set:",
//"_____Hash Scan ResultSet for T4 at read committed " +
// "isolation level using instantaneous share row" +
// "locking: ",
//"______Bit set of columns fetched=All",
//"______Scan type=heap",
//"_______Operator: ="
});
// ...so checking on the remaining output another way.
assertTrue(rtsp.findString("Right result set:",3));
assertTrue(rtsp.findString("Hash Scan ResultSet for T4 at read " +
"committed isolation level using instantaneous share row " +
"locking: ",1));
//assertTrue(rtsp.findString("Bit set of columns fetched=All",2));
//assertTrue(rtsp.findString("Scan type=heap",4));
// Now add more data to the tables.
st.executeUpdate("insert into t1 select * from t2");
st.executeUpdate("insert into t2 select * from t1");
st.executeUpdate("insert into t2 select * from t1");
st.executeUpdate("insert into t1 select * from t2");
st.executeUpdate("insert into t2 select * from t1");
st.executeUpdate("insert into t1 select * from t2");
st.executeUpdate("insert into t2 select * from t1");
st.executeUpdate("insert into t1 select * from t2");
st.executeUpdate("insert into t2 select * from t1");
st.executeUpdate("insert into t1 select * from t2");
st.executeUpdate("insert into t3 select * from t4");
st.executeUpdate("insert into t4 select * from t3");
st.executeUpdate("insert into t3 select * from t4");
st.executeUpdate("insert into t4 select * from t3");
st.executeUpdate("insert into t3 select * from t4");
st.executeUpdate("insert into t4 select * from t3");
st.executeUpdate("insert into t3 select * from t4");
st.executeUpdate("insert into t4 select * from t3");
st.executeUpdate("insert into t3 select * from t4");
st.executeUpdate("insert into t4 select * from t3");
st.executeUpdate("insert into t3 select * from t4");
/* Drop the views and recreate them with slightly different
* names. The reason we use different names is to ensure that
* the query will be "different" from the last time and thus we'll
* we'll go through optimization again (instead of just using
* the cached plan from last time).
*/
st.executeUpdate("drop view v1");
st.executeUpdate("drop view v2");
// Use of the term "DISTINCT" makes it so that we don't flatten
// the subqueries.
st.executeUpdate("create view VV1 as " +
"select distinct T1.i, T2.j from T1, T2 where T1.i = T2.i");
st.executeUpdate("create view VV2 as " +
"select distinct T3.a, T4.b from T3, T4 where T3.a = T4.a");
// Now execute the query again using the larger tables.
rs = st.executeQuery(
"select * from VV1, VV2 " +
"where VV1.j = VV2.b and VV1.i in (1,2,3,4,5)");
expColNames = new String [] {"I", "J", "A", "B"};
JDBC.assertColumnNames(rs, expColNames);
expRS = new String [][]
{
{"2", "2", "2", "2"},
{"4", "4", "4", "4"},
{"5", "5", "5", "5"}
};
JDBC.assertFullResultSet(rs, expRS, true);
rs = st.executeQuery(
"values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
rs.next();
rts = rs.getString(1);
// Now verify the correct runtimeStatistics output
rtsp = new RuntimeStatisticsParser(rts);
// print out the full stats if derby.tests.debug is true
println("full stats: \n" + rtsp.toString());
// the essentials are getting checked as per the comments
// above. If more detailed checking is needed, uncomment lines.
rtsp.assertSequence(
new String[] {
"Hash Join ResultSet:",
//"Left result set:",
//"_Sort ResultSet:",
"_Rows input = 53055",