title: Processing ResultSet of 5 million records to JSON object to avoid performance issues
body: <pre><code>while(resultSet.next()){    
      for (int c = 1; c &lt;= metaData.getColumnCount(); c++){    
          String columnName = metaData.getColumnName(c);    
          Object value = resultSet.getString(columnName);     
          record.put(columnName, value);    
      }    
  }
  </code></pre>
  
  <p>above while loop runs for 5 million times multiplied by no of columns. is there any best way to implement an efficient way to handle it..?</p>