calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Djeng Qen <pcil...@gmail.com>
Subject Re: Why executeQuery execute so slow
Date Wed, 20 May 2020 02:16:06 GMT
Thks,Got that.

I have a mistake in understanding performance,

Sorry for my unprofessional, benchmark & profiler is best.


Qen Djeng <pcilkle@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();
>   }
> }
>
>
>
>
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message