Начал изучать процедурную генерацию
scala> (30720 * 17280 * 4) / 1024 / 1024 / 1024
val res10: Int = 1
Zeroes : 1706596
Dead beefs : 4568
(sizeof(int) + 1200) * 500 = (logical size of information) = 602000
Zeroes to Used : 0.727137
PreparedStatement pst2 = conn.prepareStatement("update test set data = ? where key = ?");
byte[] deadBeef = prepareDeadBeef(BYTES); // DE AD BE EF ...
System.out.printf("size(deadBeef blob) = %d\n", deadBeef.length);
for(int i = 0; i < 500 ; i++) {
pst2.setBytes(1, deadBeef);
pst2.setInt(2, i);
pst2.execute();
}
pst2.close();
conn.commit();
conn.close();
size(deadBeef blob) = 1200
Zeroes : 2154456
Dead beefs : 160096
(sizeof(int) + 1200) * 500 = (logical size of information) = 602000
Zeroes to Used : 0.926039
Connection conn = DriverManager.getConnection("jdbc:sqlite:/db/sqlite-demo/demo.db");
conn.setAutoCommit(false);
int BYTES = 300;
int ROWS = 500;
//Blob blob = conn.createBlob(); // java.sql.SQLFeatureNotSupportedException
PreparedStatement pst = conn.prepareStatement("insert into test(key) values(?)");
for(int i = 0;i < ROWS;i++) {
pst.setInt(1, i);
pst.execute();
}
pst.close();
conn.commit();
PreparedStatement pst2 = conn.prepareStatement("update test set data = ? where key = ?");
byte[] deadBeef = prepareDeadBeef(BYTES); // DE AD BE EF ....
for(int i = 0; i < 500 ; i++) {
pst2.setBytes(1, deadBeef);
pst2.setInt(2, i);
pst2.execute();
}
pst2.close();
conn.commit();
conn.close();
/db/sqlite-demo$ ls -lF
total 176
-rwxrwxrwx 1 user user 180224 Jan 11 13:44 demo.db*
$ hexdump -C demo.db | head -n 100
00000000 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 |SQLite format 3.|
00000010 10 00 01 01 00 40 20 20 00 00 00 03 00 00 00 2c |.....@ .......,|
SELECT my_seq.CURRVAL FROM dual;