introproventures / graphql-jpa-query

Generate GraphQL Query Api for your JPA Entity Models
https://github.com/introproventures/graphql-jpa-query
Apache License 2.0
195 stars 54 forks source link

Extra query for empty query result #507

Open nosedova opened 1 week ago

nosedova commented 1 week ago

Describe the bug

Hello. The bug is about performance reduce when query result is empty.

To Reproduce

Steps to reproduce the behavior:

  1. uncomment https://github.com/introproventures/graphql-jpa-query/blob/m…

  2. Run test https://github.com/introproventures/graphql-jpa-query/blob/m…

  3. See console

There are 2 sql queries in the output. First query didn't return keys and second query select all rows again. When database is large and there is a lot of tables - it take several seconds to execute second query.

Expected behavior

Only one query has been executed

Additional context

This can be fixed by adding to https://github.com/introproventures/graphql-jpa-query/blob/m…

            if (queryKeys.isEmpty()) {

                return pagedResult.build();

            }