hasura / hasura/graphql-engine

[REQUEST] Limit the number of rows in the "where" statement.

Open
#7,288 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

I have a table of users, a table of transactions, and a table of ralations.
Each user can follow others.

I want to query the db and return the transactions of the people that user A (with the $id) is following.

```graphql
query Myquery ($id: String!) {
transactions(limit: 20, order_by: {createdAt: desc}, where: {sender: {followers: {followerId: {_eq: $id}}}}) {
id
}
}

```
This query means: Return the transactions where the transaction's sender has a follower with an id equal to the id of User A

The issue is that if user A is following thousands of users, the query will retrieve all the transactions of the thousands of users, then sort them, and return 20.
I want to limit the number of the "followers" in the where statement. How that will be possible?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.