-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
when using graphql connections to resolve relations and a limit is specified on the connection, n+1 queries are still employed on the relation even though the primary query successfully batches the query.
given the following query:
query {
log {
items {
edges {
node {
files {
edges {
node {
id
}
}
}
}
}
}
}
}
the preloads limit the result query to 1 query
but if specifying a limit (explicitly or default using GraphQL schema setting default_max_page_size)
query {
log {
items {
edges {
node {
files(first:2) {
edges {
node {
id
}
}
}
}
}
}
}
}
the batch is successfully done to build the initial log items with its associated files, but then n+1 queries are done to the files applying the limit specified. I'm not sure if there is any way to prevent this since it appears it is being generated from GraphQL-ruby
SELECT
`log`.`id` AS t0_r0,
FROM
`log`
LEFT OUTER JOIN
`files` ON `log`.`id` = `files`.`log_id`
WHERE
`log`.`id` IN (230811);
File Load (0.4ms) SELECT `files`.* FROM `files` WHERE `files`.`log_id` = 230811 LIMIT 2
I just wanted to let you know if you weren't already aware.
Metadata
Metadata
Assignees
Labels
No labels