Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.RuntimeStatisticsParser.usedSpecificIndexForIndexScan()


        JDBC.assertFullResultSet(
            st.executeQuery("select * from t1" +
                " --derby-properties index = t1_c1\n"
                "where c1 = c2"), FULL_TABLE);
        rtsp = SQLUtilities.getRuntimeStatisticsParser(st);
        assertTrue(rtsp.usedSpecificIndexForIndexScan("T1", "T1_C1"));
       
        JDBC.assertFullResultSet(
            st.executeQuery("select * from t1" +
                " --derby-properties index = t1_c1\n"
                "where c1 + 1 = 1 + c1"), FULL_TABLE);
View Full Code Here


        JDBC.assertFullResultSet(
            st.executeQuery("select * from t1" +
                " --derby-properties index = t1_c1\n"
                "where c1 + 1 = 1 + c1"), FULL_TABLE);
        rtsp = SQLUtilities.getRuntimeStatisticsParser(st);
        assertTrue(rtsp.usedSpecificIndexForIndexScan("T1", "T1_C1"));
       
        st.close();
    }
   
    public void testNestedLoopJoinStrategy()
View Full Code Here

        // sorting.
        rs = s.executeQuery("select * from (select i from ts order by i)tt");
        rtsp = SQLUtilities.getRuntimeStatisticsParser(s);

        // Verify that we use the index scan here and no sorting is incurred
        assertTrue(rtsp.usedSpecificIndexForIndexScan("TS","T_I"));
        assertFalse(rtsp.whatSortingRequired());

        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0)");
        rollback();
    }
View Full Code Here

    ps = prepareStatement("SELECT * FROM t2 WHERE c21=? AND c22=?");
      ps.setInt(1, 0);
        ps.setString(2, "Tuple 4");
        JDBC.assertDrainResults(ps.executeQuery());
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("T2","T2I1"));

    //Running the update statistics below will create statistics for T2I2
    s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','T2','T2I2')");
        rs = s.executeQuery("SELECT * FROM SYS.SYSSTATISTICS");
        JDBC.assertDrainResults(rs, 1);
View Full Code Here

        //Rerunning the query "SELECT * FROM t2 WHERE c21=? AND c22=?" and
        //looking at it's plan will show that this time it picked up more
        //efficient index which is T2I2.
        JDBC.assertDrainResults(ps.executeQuery());
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("T2","T2I2"));
        //cleanup
        s.executeUpdate("DROP TABLE t2");
        //End of test case for better index selection after statistics
        //availability
    }
View Full Code Here

            if (expectedScan.equals("Table"))
                    assertTrue(rtsp.usedTableScan());
            else if (expectedScan.equals("Index"))
            {
                assertTrue(rtsp.usedIndexScan());
                assertTrue(rtsp.usedSpecificIndexForIndexScan(
                        expTableInIndexScan, expIndexInIndexScan));
            }
            else if (expectedScan.equals("Constraint"))
            {
                assertTrue(rtsp.usedIndexScan());
View Full Code Here

            if (expectedScan.equals("Table"))
                    assertTrue(rtsp.usedTableScan());
            else if (expectedScan.equals("Index"))
            {
                assertTrue(rtsp.usedIndexScan());
                assertTrue(rtsp.usedSpecificIndexForIndexScan(
                        expTableInIndexScan, expIndexInIndexScan));
            }
            else if (expectedScan.equals("Constraint"))
            {
                assertTrue(rtsp.usedIndexScan());
View Full Code Here

        // sorting.
        rs = s.executeQuery("select * from (select i from ts order by i)tt");
        rtsp = SQLUtilities.getRuntimeStatisticsParser(s);

        // Verify that we use the index scan here and no sorting is incurred
        assertTrue(rtsp.usedSpecificIndexForIndexScan("TS","T_I"));
        assertFalse(rtsp.whatSortingRequired());

        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0)");
        rollback();
    }
View Full Code Here

        "ORDER BY m0.value";

        s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        ResultSet rs = s.executeQuery(sql1);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("TABLE2","KEY3"));
    assertTrue(rtsp.whatSortingRequired());
 
        rs = s.executeQuery(sql1);
        String[][] result = {
                {"4294967297", "000001", "21857"},
View Full Code Here

    s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
        ResultSet rs = s.executeQuery(sql1);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(
        s);
    assertTrue(rtsp.usedSpecificIndexForIndexScan("TABLE2","KEY3"));
    assertTrue(rtsp.whatSortingRequired());

    rs = s.executeQuery(sql1);
        String[][] result = {
                {"4294967297", "000001", "21857"},
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.