Commit 171b991a5ce7a05348c6dbf2d10df75d64078c14

Authored by Andrii Shvaika
1 parent 648dd81b

Added index for audit log by tenant id and created time

... ... @@ -437,6 +437,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
437 437 case "3.2.1":
438 438 try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
439 439 log.info("Updating schema ...");
  440 + conn.createStatement().execute("CREATE INDEX IF NOT EXISTS idx_audit_log_tenant_id_and_created_time ON audit_log(tenant_id, created_time);");
440 441 schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.2.1", SCHEMA_UPDATE_SQL);
441 442 loadSql(schemaUpdateFile, conn);
442 443 conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3002002;");
... ...
... ... @@ -43,3 +43,5 @@ CREATE INDEX IF NOT EXISTS idx_asset_customer_id_and_type ON asset(tenant_id, cu
43 43 CREATE INDEX IF NOT EXISTS idx_asset_type ON asset(tenant_id, type);
44 44
45 45 CREATE INDEX IF NOT EXISTS idx_attribute_kv_by_key_and_last_update_ts ON attribute_kv(entity_id, attribute_key, last_update_ts desc);
  46 +
  47 +CREATE INDEX IF NOT EXISTS idx_audit_log_tenant_id_and_created_time ON audit_log(tenant_id, created_time);
... ...