Package com.impossibl.postgres.utils

Examples of com.impossibl.postgres.utils.Timer


  }

  @Test
  public void testLargeResultSet() throws Exception {

    Timer timer = new Timer();

    for (int c = 0; c < 100; ++c) {

      try (Statement st = conn.createStatement()) {

        try (ResultSet rs = st.executeQuery("SELECT id, md5(random()::text) AS descr FROM (SELECT * FROM generate_series(1,100000) AS id) AS x;")) {

          while (rs.next()) {
            rs.getString(1);
          }

        }

      }

      System.out.println("Query Time:" + timer.getLapSeconds());
    }

  }
View Full Code Here


    prepareRefreshTypeQueries();
  }

  private void loadTypes() throws IOException, NoticeException {

    Timer timer = new Timer();

    //Load types
    String typeSQL = PgType.INSTANCE.getSQL(serverVersion);
    List<PgType.Row> pgTypes = queryResults(typeSQL, PgType.Row.class);

    //Load attributes
    String attrsSQL = PgAttribute.INSTANCE.getSQL(serverVersion);
    List<PgAttribute.Row> pgAttrs = queryResults(attrsSQL, PgAttribute.Row.class);

    //Load procs
    String procsSQL = PgProc.INSTANCE.getSQL(serverVersion);
    List<PgProc.Row> pgProcs = queryResults(procsSQL, PgProc.Row.class);

    logger.fine("query time: " + timer.getLap() + "ms");

    //Update the registry with known types
    registry.update(pgTypes, pgAttrs, pgProcs);

    logger.fine("load time: " + timer.getLap() + "ms");
  }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.utils.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.