v26.4.16
v26.4.16
Plan for Keto relationship index builds when upgrading
On PostgreSQL, CockroachDB, YugabyteDB, and SQLite, keto migrate up adds four partial indexes on keto_relation_tuples for
relationship pagination. MySQL indexes do not change.
| Index | Columns | Rows |
|---|---|---|
keto_relation_tuples_forward_sets_idx | nid, namespace, object, relation, subject_set_namespace, subject_set_relation, subject_set_object, shard_id | subject_id IS NULL |
keto_relation_tuples_forward_ids_idx | nid, namespace, object, relation, subject_id, shard_id | all subject_set_* NULL |
keto_relation_tuples_reverse_sets_idx | nid, subject_set_namespace, subject_set_object, subject_set_relation, relation, namespace, object, shard_id | subject_id IS NULL |
keto_relation_tuples_reverse_ids_idx | nid, subject_id, relation, namespace, object, shard_id | all subject_set_* NULL |
Each build reads the whole table, so allow time and disk headroom on large installations. PostgreSQL, CockroachDB, and YugabyteDB build without locking the table. The existing indexes stay, so each tuple is in five secondary indexes instead of three until a later release removes the old ones; include the added write and storage cost in your capacity planning.
If a PostgreSQL build is interrupted, it leaves an invalid index that a later migration run does not rebuild. Check
pg_index.indisvalid and run REINDEX INDEX CONCURRENTLY <index name> to repair it.