Issue Description: What’s happening?
We have a notifications table in production with 160k+ records that has a structure like this:
Attribute | Type |
---|---|
read | Boolean |
user | User Table |
agency | Agency Table |
The app we are developing is a multi-tenant app where a user can be in many agencies and notifications are filtered by those terms.
We are also using permissions to filter who can perform actions on the tables
read
{
"user": {
"id": {
"equals": "__loggedInUserId"
}
}
}
update
{
"agency": {
"agencyAgencyUserRelation": {
"some": {
"user": {
"id": {
"equals": "__loggedInUserId"
}
}
}
}
}
}
With this beign said, we have a “Mark all notifications as read” button that executes a notificationsUpdateByFilter mutation that updates notifications to read: false
mutation (
$data: {
set: {
read: true
}
},
$filter: {
agency: {
id: { equals: "<agency-id>" }
},
user: {
id: { equals: "<user-id>" }
},
read: {
equals: false
}
}
) {
notificationUpdateByFilter(data: $data, filter: $filter) {
count
}
}
The problem is that the requests takes a really long time to respond and sometimes even throws an error on CORS (With i understand as a timeout)
We think is a performance issue with the permission engine because if we disable the permissions the app executes the update really fast in comparison
With permissions
Without permissions