public String[] generateCqQueries(boolean uniqueQueries) {
    ArrayList<String> initQueries = new ArrayList<>();
    // From Portfolio object.
    String[] names = {"aaa", "bbb", "ccc", "ddd"};
    int nameIndex = 0;

    // Construct few unique Queries.
    for (int i = 0; i < 3; i++) {
      for (int cnt = 0; cnt < 5; cnt++) {
        String query = cqDUnitTest.cqs[i];
        if (cnt > 0) {
          nameIndex = (cnt % names.length);
          query += " or p.names[" + nameIndex + "] = '" + names[nameIndex] + cnt + "'";
        }
        initQueries.add(query);
      }
    }

    int numMatchedQueries = 10;
    ArrayList<String> cqQueries = new ArrayList<>();
    Iterator iter = initQueries.iterator();
    while (iter.hasNext()) {
      String query = (String) iter.next();
      for (int cnt = 0; cnt < numMatchedQueries; cnt++) {
        if (uniqueQueries) {
          // Append blank string, so that query string is different but the
          // Query constraint remains same.
          query += " ";
        }
        cqQueries.add(query);
      }
    }
    String[] queries = new String[cqQueries.size()];
    cqQueries.toArray(queries);
    return queries;
  }
Performance test for Matching CQ optimization changes.
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java