> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/guides/introduction/the-output-module-query-language/add-filtering/filtering-performance-considerations.md).

# Filtering performance considerations

When a to-many relation is traversed in the query tree, performance is impacted because a new query is made against the Collibra internal storage engine. In the above example, the relation between the community and responsibility entities is of the to-many kind because a community can have many related responsibilities. Depending on the shape and amount of results, the performance penalty can range from completely irrelevant to a sizeable chunk added to the overall query time.

Here is the optimal way to query.

{% tabs %}
{% tab title="JSON" %}

```json
{
  "ViewConfig": {
    "Resources": {
      "Community": {
        "Id": { "name": "communityId" },
        "Name": { "name": "communityName" },
        "Responsibility": {
          "Id": { "name": "responsibilityId" },
          "User": {
            "Id": { "name": "userId" },
            "FirstName": { "name": "firstName" },
            "LastName": { "name": "lastName" }
          },
          "Group": {
            "Id": { "name": "groupId" },
            "GroupName": { "name": "groupName" }
          },
          "Role": {
            "Signifier": { "name": "roleName" }
          }
        }
      }
    }
  }
}
```

{% endtab %}

{% tab title="YAML" %}

```yaml
---
ViewConfig:
  Resources:
    Community:
      Id:
        name: "communityId"
      Name:
        name: "communityName"
      Responsibility:
        Id:
          name: "ResponsibilityId"
        User:
          Id:
            name: "userId"
          FirstName:
            name: "firstName"
          LastName:
            name: "lastName"
        Group:
          Id:
            name: "groupId"
          GroupName:
            name: "groupName"
        Role:
          Signifier:
            name: "roleName"
```

{% endtab %}
{% endtabs %}

The results should be formatted like the example below.

```json
{
  "view": {
    "Community0": [
      {
        "communityId": "c87f166e-041f-4bea-8ff7-c1ffbab2ceeb",
        "communityName": "First Community"
      },
      {
        "communityId": "12345678-0020-0000-0000-000000000000",
        "communityName": "Second Community",
        "Responsibility1": [
          {
            "responsibilityId": "0ecb2fff-d5de-43d0-be60-f7f201c10d41",
            "User2": [
              {
                "userId": "00000000-0000-0000-0000-000000900002",
                "firstName": "Admin",
                "lastName": "Istrator"
              }
            ],
            "Group3": [
              {}
            ],
            "Role4": [
              {
                "roleName": "Admin"
              }
            ]
          },
          {
            "responsibilityId": "42b9d114-2c0c-4e96-a1ce-b645d5e92365",
            "User2": [
              {
                "userId": "00000000-0000-0000-0000-000000900002",
                "firstName": "Admin",
                "lastName": "Istrator"
              }
            ],
            "Group3": [
              {}
            ],
            "Role4": [
              {
                "roleName": "Steward"
              }
            ]
          },
          {
            "responsibilityId": "5fc0cc5f-e30e-488c-94bc-acdea171219d",
            "User2": [
              {}
            ],
            "Group3": [
              {
                "groupId": "4eb1f4a9-14a3-4539-8afc-733925161179",
                "groupName": "admin"
              }
            ],
            "Role4": [
              {
                "roleName": "Admin"
              }
            ]
          }
        ]
      }
    ]
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.collibra.com/api/guides/introduction/the-output-module-query-language/add-filtering/filtering-performance-considerations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
