Timeout on query with over 330 000 rows (Due Permissions)

We have a table with a little more than 333 000 rows and it times out when doing a query that span across multiple relationships.

This query is pulling the first 20 rows and it looks like this:

query($agency: ID, $user: ID!) {
    notificationsList(
      first: 20
      sort: { createdAt: DESC }
      filter: {
        read: { equals: false }
        agency: { id: { equals: $agency } }
        user: { id: { equals: $user } }
      }
    ) {
      items {
        id
    type
    read
    createdAt
    userTrigger {
      id
      firstName
      lastName
      avatar {
        id
        downloadUrl
      }
    }
    lead {
      firstName
      lastName
      id
    }
    email {
      id
      subject
      from
      thread {
        id
      }
    }
    campaign {
      name
      id
    }
    disposition {
      id
      expirationDate
    }
      }
      count
    }
  }

The query only fails with the current permission filters that we have, if we remove some of the filters then it works faster.

@sebastian.scholl @evgeny.semushin

1 Like

Thanks for the heads up @alacret