Iterator tablesIter = tables.iterator(); while (tablesIter.hasNext()) { if (full) { String sql = "VACUUM FULL ANALYSE " + (String) tablesIter.next(); LOG.info(sql); s.execute(sql); } else { String sql = "ANALYSE " + (String) tablesIter.next(); LOG.info(sql); s.execute(sql); }
if (full) { s.execute("VACUUM FULL ANALYSE"); } else { s.execute("ANALYSE");
    public static void analyse(Database db, ClassDescriptor cld, boolean full) throws SQLException {        Set tables = new HashSet();        tables.add(getTableName(cld));        tables.addAll(getIndirectionTableNames(cld));        Connection conn = db.getConnection();        boolean autoCommit = conn.getAutoCommit();        try {            conn.setAutoCommit(true);            Statement s = conn.createStatement();            Iterator tablesIter = tables.iterator();            while (tablesIter.hasNext()) {                if (full) {                    String sql = "VACUUM FULL ANALYSE " + (String) tablesIter.next();                    LOG.info(sql);                    s.execute(sql);                } else {                    String sql = "ANALYSE " + (String) tablesIter.next();                    LOG.info(sql);                    s.execute(sql);                }            }            conn.setAutoCommit(autoCommit);        } finally {            conn.setAutoCommit(autoCommit);            conn.close();        }    }