workItemNotesByIid exceeds query complexity

We see that the query fails on work items when accessing it as an anonymous user. And when I check the complexity rake task is exceeding the threshold:

 - complexity: 429

This leads to the following bug:

  1. Anonymous users can't read comments from work items (on production I see a complexity of 218, and the threshold is 200)
  2. The complexity based on our task is 429 which actually means that it could also be an issue for signed in users where the threshold is 250