running the below query in sqlline takes less than 4 sec  but when calling from Java client the first resultSet.next() is much slower (>20 sec), any ideas?


client code

String JDBC_DRIVER = "jdbc:phoenix:myip";

String query = "SELECT ROWKEY FROM mytable LIMIT 10000";

//ROWKEY size=32bytes, mytable size=4M rows (128 regions on 3 servers with 40GB heap)

Class.forName("com.salesforce.phoenix.jdbc.PhoenixDriver");

DriverManager.getConnection(JDBC_DRIVER);

Connection con = DriverManager.getConnection(JDBC_DRIVER);

Statement stmt  = con.createStatement();

ResultSet resultSet =stmt.executeQuery(query);

Object o = null; int i=0;boolean isFirst = true;

long start = System.currentTimeMillis();

while(resultSet.next()){

if (isFirst){

System.out.println("Time taken for first getNext() : " + (System.currentTimeMillis() - start));

isFirst = false;

}

for (i = 0; i < colmax; ++i)

{

o = resultSet.getObject(i + 1);

if (o != null){

//rowKeys.add(o.toString());

}

}

}

System.out.println("Time taken to  loop through : " + (System.currentTimeMillis() - start));