Thks,Got that.

I have a mistake in understanding performance,

Sorry for my unprofessional, benchmark & profiler is best.


Qen Djeng <pcil...@gmail.com> 于2020年5月16日周六 下午11:04写道:

>
>
> 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();
>   }
> }
>
>
>
>
>
>
>
>
>

Reply via email to