import java.sql.*; public class Commit { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5820/jurka", "jurka", ""); conn.setAutoCommit(false); Statement stmt = conn.createStatement(); for (int j=0; j<10; j++) { long t1 = System.currentTimeMillis(); for (int i=0; i<10000; i++) { ResultSet rs = stmt.executeQuery("SELECT 1"); rs.close(); conn.commit(); } long t2 = System.currentTimeMillis(); System.out.println(t2 - t1); } } }