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

fix query for non empty query keys #512

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nosedova
Copy link

There is a new problem after fixing redundant fetch query for empty query keys results (#508). If the query results are not empty, queryBuilder doesn't use them, so complexity of second query increases exponentially. Especially if the selection is made not based on the attributes of the root entity. Good example is testGraphqlTasksQueryWithEQNullValues in GraphQLJpaConverterTests.java.

Before fix query was:

    select
        distinct te1_0.id,
...
        te1_0.status 
    from
        task te1_0 
    where
        te1_0.status in (?, ?) 
        and te1_0.due_date is null 
    order by
        te1_0.priority desc,
        te1_0.due_date

and after is:

    select
        distinct te1_0.id,
...
        te1_0.status 
    from
        task te1_0 
    where
        te1_0.status in (?, ?) 
        and te1_0.due_date is null 
        and te1_0.id in (?, ?, ?, ?)
    order by
        te1_0.priority desc,
        te1_0.due_date

There was a new problem after fixing redundant fetch query for empty query keys results.
If the query results are not empty, queryBuilder doesn't use them, so complexity of second query increases exponentially. Especially if the selection is made not based on the attributes of the root entity.
Good example is testGraphqlTasksQueryWithEQNullValues in GraphQLJpaConverterTests.java.

Before fix query was:

    select
        distinct te1_0.id,
...
        te1_0.status 
    from
        task te1_0 
    where
        te1_0.status in (?, ?) 
        and te1_0.due_date is null 
    order by
        te1_0.priority desc,
        te1_0.due_date

and after is:
    select
        distinct te1_0.id,
...
        te1_0.status 
    from
        task te1_0 
    where
        te1_0.status in (?, ?) 
        and te1_0.due_date is null 
        and te1_0.id in (?, ?, ?, ?) 
    order by
        te1_0.priority desc,
        te1_0.due_date
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