Hey folks 👋 looking for some help with
# spicedb
z
Hey folks 👋 looking for some help with a schema fan-out issue that we're seeing, our stylized schema below
Copy code
definition restriction { // modeling restricted token auth
// when a user with oauth token makes request, the subject is the restriction object not the user 
}

definition user {
relation oauth_user_read: restriction 
}

definition firm {
relation member: user 
permission can_view = member->oauth_user_read
}

definition asset {
relation firm: firm
relation owner: user
permission can_view = firm->can_view + owner
}
Permission check for can_view on asset is very frequent, and most of the time it's taking the latter branch (on the owner relation). We're seeing perf issues with fan out (firm#member size is large when computing firm->can_view). I tried enabling the query planner mode (since the two paths on asset can_view permission are different resource types) but that didn't resolve the issue. Wondering if you have any suggestions?
y
looking at [the code](https://github.com/authzed/spicedb/blob/main/pkg/query/advisor_count.go), i think the issue is that we haven't gotten to hooking up the count-based advisor to union and intersection reordering - it's only being used for arrow reversal right this second
is the issue that datastore load is higher than you want it to be, or is it that latency is high compared to what it would be if it were taking the right branch more often?
z
yea the latency is really high because of the extra (unnecessary) computation
for my understanding - what's the tradeoff for bumping the dispatch chunk size from 100 to like 1000? what should I be looking out for?
bump^ maybe q for @Joey as well since you recommended increasing the chunk size
j
It can make the queries bigger and if you only need one to be true
But usually little downside
9 Views