Bumped HSQLDB to v2.5.1 and AT/cross-chain SQL speed-ups!

This commit is contained in:
catbref
2020-08-15 11:12:10 +01:00
parent 7a569f342f
commit b9d819220d
3 changed files with 47 additions and 5 deletions

View File

@@ -269,9 +269,10 @@ public class HSQLDBATRepository implements ATRepository {
String sql = "SELECT height, created_when, state_data, state_hash, fees, is_initial "
+ "FROM ATStates "
+ "WHERE AT_address = ? "
+ "ORDER BY height DESC "
+ "LIMIT 1 "
+ "USING INDEX";
// AT_address then height so the compound primary key is used as an index
// Both must be the same direction also
+ "ORDER BY AT_address DESC, height DESC "
+ "LIMIT 1 ";
try (ResultSet resultSet = this.repository.checkedExecute(sql, atAddress)) {
if (resultSet == null)
@@ -307,7 +308,9 @@ public class HSQLDBATRepository implements ATRepository {
sql.append(minimumFinalHeight);
}
sql.append( "ORDER BY height DESC "
// AT_address then height so the compound primary key is used as an index
// Both must be the same direction also
sql.append( "ORDER BY AT_address DESC, height DESC "
+ "LIMIT 1 "
+ ") AS FinalATStates "
+ "WHERE code_hash = ? ");