Hi Qen, I don't understand exactly what are the times that you are mentioning. You are measuring the time from 1000 executions of the query so if it is 11ms per query then it doesn't look so slow.
Apart from that, if something is slow the typical suggestion is use a profiler and let us know what we can do to improve. Best, Stamatis On Sat, May 16, 2020 at 6:35 PM Qen Djeng <[email protected]> wrote: > > Why executeQuery execute so slow?, spend 11176ms on execute 1000s > executeQuery! > > Is there anything wrong in my code. > > public class Main { > public static class HrSchema { > public final Employee[] emps = new Employee[] { > new Employee() > }; > } > public static void main(String[] args) throws Exception { > > Class.forName("org.apache.calcite.jdbc.Driver"); > Properties info = new Properties(); > info.setProperty("lex", "JAVA"); > Connection connection = > DriverManager.getConnection("jdbc:calcite:", info); > CalciteConnection calciteConnection = > connection.unwrap(CalciteConnection.class); > SchemaPlus rootSchema = calciteConnection.getRootSchema(); > Schema schema = new ReflectiveSchema(new HrSchema()); > rootSchema.add("hr", schema); > Statement statement = calciteConnection.createStatement(); > > long start = System.currentTimeMillis(); > for(int i = 0; i < 1000; i++) { > ResultSet resultSet = statement.executeQuery( > "select * from hr.emps where name = 'name'"); > while (resultSet.next()) { > } > resultSet.close(); > } > System.out.println(System.currentTimeMillis() - start); > statement.close(); > connection.close(); > } > } > > > > >
