hasura / hasura/graphql-engine
Remote schema N+1 issue with a Hasura Remote Schema
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Batch remote schema requests into one sql request
N+1 problem with a remote schema in a Hasura implementation. Specifically, a remote relationship is defined between a local table(employee) and a remote table (employeelanguages). The sample below causes multiple individual requests to the remote schema instead of a single batched request:
```
query Employee {
employee {
name
employeelanguages {
id
name
}
}
```
### Describe the solution you'd like
Make one SQL query to the employeelanguages instead of multiple queries.
### Describe alternatives you've considered
Contributor guide
Research direction
Start with the supplied Employee query and trace how Hasura generates requests for the remote relationship. Verify the current request count, then make the employee languages lookup use one batched SQL request; the query should return the same fields without individual remote requests per employee.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, sql
- Domain
- api, backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100