title: How to improve the select query performance in Java?
body: <p>I am using BerkeleyDB Database and I am performing <code>select</code> query that require 409 ms.  How to improve the select query performance?</p>
  
  <p>I am using the following code:</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.Statement;
  
  public class ReadData {
  
  Connection con=null;
  ResultSet rs=null;
  Statement smt = null;
  
  public void readData() 
  {
       try
       {
           Class.forName("SQLite.JDBCDriver");
           con = DriverManager.getConnection("jdbc:sqlite:/D:\\DB\\Mediation.db");
           smt = con.createStatement();
  
           long startTime = System.currentTimeMillis();
           rs = smt.executeQuery("select * from CDRData");             
           while(rs.next())
           {
               System.out.println(rs.getString(1)+" , "+rs.getString(2)+" , "+rs.getString(3)+" , "+rs.getString(4)+" , "+rs.getString(5)+" , "+rs.getString(6)+" , "+rs.getString(7)+" , "+rs.getString(8)+" , "+rs.getString(9)+" , "+rs.getString(10)+" , "+rs.getString(11)+" , "+rs.getString(12)+" , "+rs.getString(13)+" , "+rs.getString(14)+" , "+rs.getString(15)+" , "+rs.getString(16)+" , "+rs.getString(17)+" , "+rs.getString(18)+" , "+rs.getString(19)+" , "+rs.getString(20)+" , "+rs.getString(21)+" , "+rs.getString(22)+" , "+rs.getString(23));
           }
           long finishTime = System.currentTimeMillis();
           System.out.println("The time taken by select query : "+(finishTime-startTime)+ " ms");
       }
       catch(Exception e)
       {
           System.out.println("Error ---- "+e);
       }
  }
  
  public static void main(String[] args) {
      ReadData csvread = new ReadData();
      csvread.readData();
  }
  }
  </code></pre>