commit | 4b7209d7df1056403cde0b71021d512afce560e3 | [log] [tgz] |
---|---|---|
author | Saša Živkov <sasa.zivkov@sap.com> | Thu Apr 04 16:53:04 2024 +0200 |
committer | Saša Živkov <sasa.zivkov@sap.com> | Thu Apr 04 16:53:04 2024 +0200 |
tree | 3dbc25dd97cd061d73ffa142e0b58fb255f970d6 | |
parent | 4420b5d56dec67905915de473d66633b2aa4c4b0 [diff] |
Add index on (project, time) This allows for efficient queries for all ref-updates in a given project before/after some time. Change-Id: If725ffa945d265167f8b3caaf8a0742264f5aa65
diff --git a/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/DatabaseSchemaCreator.java b/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/DatabaseSchemaCreator.java index 0bf042e..aa8c4ac 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/DatabaseSchemaCreator.java +++ b/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/DatabaseSchemaCreator.java
@@ -62,7 +62,8 @@ + ")" + "PRIMARY KEY (project, ref)", "ALTER TABLE refs ADD COLUMN IF NOT EXISTS " - + "time TIMESTAMP OPTIONS (allow_commit_timestamp=true)"), + + "time TIMESTAMP OPTIONS (allow_commit_timestamp=true)", + "CREATE INDEX IF NOT EXISTS project_time ON refs(project, time)"), null) .get(); } catch (Exception e) {