// getConnection("speed;ASSERT=0;MAX_MEMORY_ROWS=1000000;MAX_LOG_SIZE=1000");
// Class.forName("org.hsqldb.jdbcDriver");
// conn = DriverManager.getConnection("jdbc:hsqldb:speed");
Statement stat = conn.createStatement();
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
int len = getSize(1, 10000);
for (int i = 0; i < len; i++) {
stat.execute("SELECT ID, NAME FROM TEST ORDER BY ID");
}
// drop table if exists test;
// CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
// @LOOP 100000 INSERT INTO TEST VALUES(?, 'Hello');
// @LOOP 100000 SELECT * FROM TEST WHERE ID = ?;
// stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME
// VARCHAR(255))");
// for(int i=0; i<1000; i++) {
// stat.execute("INSERT INTO TEST VALUES("+i+", 'Hello')");
// }
// stat.execute("CREATE TABLE TEST_A(ID INT PRIMARY KEY, NAME
// VARCHAR(255))");
// stat.execute("INSERT INTO TEST_A VALUES(0, 'Hello')");
long time = System.currentTimeMillis();
// for(int i=1; i<8000; i*=2) {
// stat.execute("INSERT INTO TEST_A SELECT ID+"+i+", NAME FROM TEST_A");
//
// // stat.execute("INSERT INTO TEST_A VALUES("+i+", 'Hello')");
// }
// for(int i=0; i<4; i++) {
// ResultSet rs = stat.executeQuery("SELECT * FROM TEST_A");
// while(rs.next()) {
// rs.getInt(1);
// rs.getString(2);
// }
// }
// System.out.println(System.currentTimeMillis()-time);
//
// stat.execute("CREATE TABLE TEST_B(ID INT PRIMARY KEY, NAME
// VARCHAR(255))");
// for(int i=0; i<80000; i++) {
// stat.execute("INSERT INTO TEST_B VALUES("+i+", 'Hello')");
// }
// conn.close();
// System.exit(0);
// int testParser;
// java -Xrunhprof:cpu=samples,depth=8 -cp . org.h2.test.TestAll
//
// stat.execute("CREATE TABLE TEST(ID INT)");
// stat.execute("INSERT INTO TEST VALUES(1)");
// ResultSet rs = stat.executeQuery("SELECT ID OTHER_ID FROM TEST");
// rs.next();
// rs.getString("ID");
// stat.execute("DROP TABLE TEST");
// long time = System.currentTimeMillis();
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("CREATE CACHED TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)");
int max = getSize(1, 10000);
for (int i = 0; i < max; i++) {
prep.setInt(1, i);