Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V5 logical operator filter performance optimization #212

Open
wants to merge 2 commits into
base: v5
Choose a base branch
from

Conversation

adamni21
Copy link

@adamni21 adamni21 commented Jul 1, 2024

This vastly improves performance for the and/or filters for tables with many filter fields. (When the filters are defined via a variable, the performance for inlined filters stays roughly the same.)

For example a table with 256 fields, a query with 16 elements for the or-filter, each of the elements doing using 1 operator on 1 field (eg. {"field0": {"equalTo": "test"}})

It gets the execution time of establishOperationPlan from ~25s down to 10~15ms for the example provided.
Time measurements from chrome dev tools' performance tab, and after 10~15 request so JIT could do it's job.

query test($filter: LargeTableFilter, $orderBy: [LargeTablesOrderBy!]) {
  allLargeTables(filter: $filter, orderBy: $orderBy) {
    nodes {
      field0
    }
  }
}

with variables

{
  "filter": {
    "or": [
      {
        "field0": {
          "equalTo": "test"
        }
      },
      {
        "field1": {
          "equalTo": "test"
        }
      },
      {
        "field2": {
          "equalTo": "test"
        }
      },
      {
        "field3": {
          "equalTo": "test"
        }
      },
      {
        "field4": {
          "equalTo": "test"
        }
      },
      {
        "field5": {
          "equalTo": "test"
        }
      },
      {
        "field6": {
          "equalTo": "test"
        }
      },
      {
        "field7": {
          "equalTo": "test"
        }
      },
      {
        "field8": {
          "equalTo": "test"
        }
      },
      {
        "field9": {
          "equalTo": "test"
        }
      },
      {
        "field10": {
          "equalTo": "test"
        }
      },
      {
        "field11": {
          "equalTo": "test"
        }
      },
      {
        "field12": {
          "equalTo": "test"
        }
      },
      {
        "field13": {
          "equalTo": "test"
        }
      },
      {
        "field14": {
          "equalTo": "test"
        }
      },
     {
        "field15": {
          "equalTo": "test"
        }
      }
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant