dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[BUG]: Graphql query does not honour first: when sorting

Open miko opened this issue 1 year ago • 0 comments

What version of Dgraph are you using?

Dgraph version : v24.0.5 Dgraph codename : dgraph Dgraph SHA-256 : 7139a5b0cf1faaf766e3ca9b6966f2893bbddf6a8261efebf4208dfb239b7a45 Commit SHA-1 : 27450c1 Commit timestamp : 2024-11-05 23:22:41 +0530 Branch : HEAD Go version : go1.22.8 jemalloc enabled : true

Tell us a little more about your go-environment?

Not relevant

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, CPU, OS)?

Not relevant

What steps will reproduce the bug?

Create graphql schema with: type User { login: String! }

Insert more than 1000 records (like 30000) Execute graphql queries:

 Users1: queryUser(first:30000,order: { asc: login }) {
      login
  }
  Users2: queryUser(first:30000) {
      login
  }

Execute DQL queries:

query {
Users3(func:type(User),  first:30000) {
  login: User.login
}
Users4(func:type(User),orderasc:User.login, first:30000) {
  login: User.login
}
}  ```

### Expected behavior and actual result.

As mentioned at https://dgraph.io/docs/query-language/sorting/ "Sorted queries retrieve up to 1000 results by default. This can be changed with first." This works for DQL queries, but not for graphql queries - Users1 returns only 1000 records instead of expected 3000 records without a warning.
The 1000 items limit is not even mentioned for GraphQL API (as it should be): https://dgraph.io/docs/graphql/queries/order-page/

### Additional information

The issue was mentioned before:
https://discuss.dgraph.io/t/bug-dgraph-is-limiting-query-results-that-use-order-to-1000/16160

miko avatar Dec 10 '24 11:12 miko