Examples of usedDistinctScan()


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

                 {"12", "rrrr"} };                    
    stmt.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");     
    JDBC.assertFullResultSet(stmt.executeQuery("select i, b from t3 FOR UPDATE"), expectedValues);
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(stmt);
    assertTrue(rtsp.usedTableScan());
    assertFalse(rtsp.usedDistinctScan());
    commit();

    PreparedStatement p = prepareStatement("select i, b from t3  where i = ? FOR UPDATE");
                p.setString(1, "7");
                p.executeQuery();
View Full Code Here

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

                p.executeQuery();
    String [][] expectedValues1 = { {"7", "iiii" } };
    JDBC.assertFullResultSet(p.getResultSet(), expectedValues1);
    RuntimeStatisticsParser rtsp2 = SQLUtilities.getRuntimeStatisticsParser(stmt);
    assertFalse(rtsp2.usedTableScan());
    assertFalse(rtsp2.usedDistinctScan());
    p.close();
    commit();


    p = prepareStatement("select i, b from t3 where i < ? FOR UPDATE");
View Full Code Here

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

            {"5", "jjjj" },
            {"6", "rrrr" } };
    JDBC.assertFullResultSet(p.getResultSet(), expectedValues2);
    RuntimeStatisticsParser rtsp3 = SQLUtilities.getRuntimeStatisticsParser(stmt);
    assertFalse(rtsp3.usedTableScan());
    assertFalse(rtsp3.usedDistinctScan());             
    p.close();
    commit();


    p = prepareStatement("select i, b from t3  where b = ? FOR UPDATE");
View Full Code Here

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

                p.executeQuery();
    String[][] expectedValues3 = { {"10", "cccc" } };
    JDBC.assertFullResultSet(p.getResultSet(), expectedValues3);
    RuntimeStatisticsParser rtsp4 = SQLUtilities.getRuntimeStatisticsParser(stmt);
    assertFalse(rtsp4.usedTableScan());
    assertFalse(rtsp4.usedDistinctScan());
    p.close();
    commit();

          stmt.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0)")
            stmt.close();
View Full Code Here

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

    // distinct names should be returned
    // runtime statistics should not have Distinct Scan in it
    assertRowCount(3, s.executeQuery("select distinct name from (select name, id from names) as n"));
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedTableScan());
    assertFalse(rtsp.usedDistinctScan());
   
    // distinct names should be returned
    // runtime statistics should have Distinct Scan in it
    assertRowCount(3, s.executeQuery("select distinct name from (select name from names) as n"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
View Full Code Here

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

    // distinct names should be returned
    // runtime statistics should have Distinct Scan in it
    assertRowCount(3, s.executeQuery("select distinct name from (select name from names) as n"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertFalse(rtsp.usedTableScan());
    assertTrue(rtsp.usedDistinctScan());
   
    // runtime statistics should have Distinct Scan in it
    assertRowCount(6, s.executeQuery("select distinct a, b, b, a from (select y as a, x as b from (select id as x, name as y from names) as n) as m"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertFalse(rtsp.usedTableScan());
View Full Code Here

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

   
    // runtime statistics should have Distinct Scan in it
    assertRowCount(6, s.executeQuery("select distinct a, b, b, a from (select y as a, x as b from (select id as x, name as y from names) as n) as m"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertFalse(rtsp.usedTableScan());
    assertTrue(rtsp.usedDistinctScan());
   
    // runtime statistics should not have Distinct Scan in it
    assertRowCount(3, s.executeQuery("select distinct a, a from (select y as a from (select id as x, name as y from names) as n) as m"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedTableScan());
View Full Code Here

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

   
    // runtime statistics should not have Distinct Scan in it
    assertRowCount(3, s.executeQuery("select distinct a, a from (select y as a from (select id as x, name as y from names) as n) as m"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedTableScan());
    assertFalse(rtsp.usedDistinctScan());
   
    s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0)");
    s.execute("drop table names");
    s.close();
  }
View Full Code Here

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

    Statement s = createStatement();
    s.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
   
    assertRowCount(1, s.executeQuery("select distinct c2 from one"));
    RuntimeStatisticsParser rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedDistinctScan());
   
    // Derby251 Distinct should not get eliminated for following query
    // because there is no equality condition on unique column of table
    // in the outside query
    assertRowCount(2, s.executeQuery("select distinct q1.\"NO1\",  q1.\"NAME\",  q1.\"AUDITOR_NO\",  q1.\"REPORTTO_NO\",  q1.\"DISCRIM_DEPT\",  q1.\"SOFTWAREASSET\" from IDEPT q1, IDEPT q2" +
View Full Code Here

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

    // distinct is executed.  So test by retrieving data into a temp table and
    // return results ordered after making sure the query was executed as expected
    s.execute("create table temp_result (c2 int, c3 int)");
    s.execute("insert into temp_result select distinct c2, c3 from two");
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
    assertTrue(rtsp.usedDistinctScan());
   
    // Try same query, but with an order by at the end.  This will use the sort for
    // the "order by" to do the distinct and not do a "DISTINCT SCAN".
    assertRowCount(3, s.executeQuery("select distinct c2, c3 from two order by c2, c3"));
    rtsp = SQLUtilities.getRuntimeStatisticsParser(s);
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.