Commit 171b991a5ce7a05348c6dbf2d10df75d64078c14
1 parent
648dd81b
Added index for audit log by tenant id and created time
Showing
2 changed files
with
3 additions
and
0 deletions
@@ -437,6 +437,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService | @@ -437,6 +437,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService | ||
437 | case "3.2.1": | 437 | case "3.2.1": |
438 | try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { | 438 | try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { |
439 | log.info("Updating schema ..."); | 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 | schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.2.1", SCHEMA_UPDATE_SQL); | 441 | schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.2.1", SCHEMA_UPDATE_SQL); |
441 | loadSql(schemaUpdateFile, conn); | 442 | loadSql(schemaUpdateFile, conn); |
442 | conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3002002;"); | 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,3 +43,5 @@ CREATE INDEX IF NOT EXISTS idx_asset_customer_id_and_type ON asset(tenant_id, cu | ||
43 | CREATE INDEX IF NOT EXISTS idx_asset_type ON asset(tenant_id, type); | 43 | CREATE INDEX IF NOT EXISTS idx_asset_type ON asset(tenant_id, type); |
44 | 44 | ||
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); | 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); |