GraphQL API perf optimizations#2252
Open
peferron wants to merge 7 commits into
Open
Conversation
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
39c0039 to
43c78de
Compare
shangyian
reviewed
Jun 12, 2026
shangyian
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for adding this @peferron!
Remove an apparently obsolete LIKE '%DOT% filter which couldn't use indexes—I'll need confirmation that this is indeed safe to remove.
I just ran some confirmation queries in Postgres and this looks like a reasonable assumption:
dj=> SELECT cr.cube_id, col.name, col.node_revision_id, nr.type
FROM cube cr
JOIN "column" col ON col.id = cr.cube_element_id
LEFT JOIN noderevision nr ON nr.id = col.node_revision_id
WHERE (col.name LIKE '%\_DOT\_%' ESCAPE '\')
<> (col.node_revision_id IS NOT NULL AND nr.type = 'METRIC')
LIMIT 50;
cube_id | name | node_revision_id | type
---------+------+------------------+------
(0 rows)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR optimizes the performance of fetching cubes via GraphQL.
nameto sibling fields. That's the largest gain; around 2x faster when running locally against a copy of our database. I didn't measure a significant perf regression for name-only use cases.node.type, which is useful when fetching cubes since they only represent a small fraction of the overall nodes.EXISTSsubquery instead, which the Postgres planner will optimize as needed.LIKE '%_DOT_%filter which couldn't use indexes—I'll need confirmation that this is indeed safe to remove.Also adds support for
@includeand@skipdirectives; before clients would have to alter the query string itself to get the expected perf gains, which is inconvenient.Finally, fixes an existing bug (happening on
main) where metrics and dimensions within revisions are empty unless non-namefields are also selected. For example, the query below returns empty metrics and dimensions, unless you uncomment some of the fields: