New Ory Agent Security is now live! Claim your complimentary test drive. Get Started!

Skip to main content

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.

IndexColumnsRows
keto_relation_tuples_forward_sets_idxnid, namespace, object, relation, subject_set_namespace, subject_set_relation, subject_set_object, shard_idsubject_id IS NULL
keto_relation_tuples_forward_ids_idxnid, namespace, object, relation, subject_id, shard_idall subject_set_* NULL
keto_relation_tuples_reverse_sets_idxnid, subject_set_namespace, subject_set_object, subject_set_relation, relation, namespace, object, shard_idsubject_id IS NULL
keto_relation_tuples_reverse_ids_idxnid, subject_id, relation, namespace, object, shard_idall 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.