@Test
  public void testPerformanceForRangeQueries() {
    try {
      // ds = DistributedSystem.connect(props);
      // cache = CacheFactory.create(ds);
      /*
       * AttributesFactory factory = new AttributesFactory();
       * factory.setScope(Scope.DISTRIBUTED_ACK); factory.setValueConstraint(Portfolio.class);
       */
      region = CacheUtils.createRegion("Portfolio", Portfolio.class);
      for (int i = 0; i < 25000; ++i) {
        region.create(i + 1, new Portfolio(i));
      }
      String queryStr = "select  * from " + SEPARATOR
          + "Portfolio pf where pf.getID  > 10000 and pf.getID < 12000";

      SelectResults[][] r = new SelectResults[1][2];
      QueryService qs = CacheUtils.getQueryService();
      Query qry = qs.newQuery(queryStr);
      for (int i = 0; i < 5; ++i) {
        qry.execute();
      }

      long time = 0l;
      long start = 0;
      long end = 0;
      int numTimesToRun = 10;
      SelectResults sr = null;
      float t1, t2 = 0;
      for (int i = 0; i < numTimesToRun; ++i) {
        start = System.currentTimeMillis();
        sr = (SelectResults) qry.execute();
        end = System.currentTimeMillis();
        time += (end - start);
      }
      r[0][0] = sr;
      t1 = ((float) (time)) / numTimesToRun;
      CacheUtils.log("AVG time taken without Index =" + t1);
      qs.createIndex("ID", IndexType.FUNCTIONAL, "pf.getID", SEPARATOR + "Portfolio pf");
      for (int i = 0; i < 5; ++i) {
        qry.execute();
      }

      time = 0l;
      start = 0;
      end = 0;
      sr = null;
      for (int i = 0; i < numTimesToRun; ++i) {
        start = System.currentTimeMillis();
        sr = (SelectResults) qry.execute();
        end = System.currentTimeMillis();
        time += (end - start);
      }
      r[0][1] = sr;
      t2 = ((float) (time)) / numTimesToRun;
      CacheUtils.log("AVG time taken with Index =" + t2);
      CacheUtils.compareResultsOfWithAndWithoutIndex(r, this);
      assertTrue("Avg. Time taken to query with index should be less than time taken without index",
          t2 < t1);


    } catch (Exception e) {
      e.printStackTrace();
      fail("Test failed due to exception=" + e);
    }

  }
Get the performance of Range query in an AND junction.
geode-core/src/performanceTest/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java