Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds new index to help support DeleteRelationships with limit
For folks running schema migrations, which typically involve deleting relationships of one of the relations affected in their schema, we recommend using DeleteRelationship API with limit enabled not to overload the database in situations where relations have millions of relationships. DeleteRelationships with limits is fundamentally different in that it has to do a SELECT first because Postgres does not support DELETE ... LIMIT statements. That particular SELECT statement was found to be unindexed and be extremely slow in SpiceDB clusters with millions of relationships. This commit adds a new index to support that access pattern and make deletes+limit faster and less impactful overall.⚠️ This index uses the xid8 type and also requires Postgres 15 for the query planner to do the right thing.
- Loading branch information