phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alex kamil <alex.ka...@gmail.com>
Subject resultSet.next() is slow
Date Tue, 11 Mar 2014 19:30:35 GMT
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));

Mime
View raw message