spicedb icon indicating copy to clipboard operation
spicedb copied to clipboard

checkDirect optimizations

Open josephschorr opened this issue 4 years ago • 0 comments

In https://github.com/authzed/spicedb/blob/main/internal/graph/check.go#L61, we perform a lookup of all relationships under a relation, and then search for the goal subject, as well as kicking off the recursive checks if a non-terminal subject is found.

We should consider making the following optimizations:

  • [ ] Check for the goal subject directly in a single query, without a loop, and only if that subject relation is possible on the relation (via type information, if present)
  • [ ] Lookup only the non-terminal ONRs in its own query and use those results to issue recursive checks
  • [ ] Perform both of the above in parallel

josephschorr avatar Sep 22 '21 18:09 josephschorr