fix(graphql): make type-filtered objects queries use sane plans - #12662
Open
tomxey wants to merge 2 commits into
Open
fix(graphql): make type-filtered objects queries use sane plans#12662tomxey wants to merge 2 commits into
tomxey wants to merge 2 commits into
Conversation
Rewrite the consistent-view anti-join as NOT EXISTS and raise the extended-statistics targets on the backward-diff tables, so type filters on types with many objects no longer time out.
tomxey
force-pushed
the
sc-platform/fix-graphql-type-filter-timeout
branch
from
August 13, 2026 12:54
46ed910 to
6635e72
Compare
tomxey
marked this pull request as ready for review
August 14, 2026 06:29
The old comment blamed the JOIN; the actual problem was the SELECT DISTINCT subquery hiding the object_id condition from the planner.
kodemartin
approved these changes
Aug 14, 2026
sergiupopescu199
approved these changes
Aug 18, 2026
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.
Description of change
objects(filter: { type })timed out on testnet for types with many objects (e.g.0x3::staking_pool::StakedIota, 53k objects). Two fixes for this:LEFT JOIN (SELECT DISTINCT ...)toNOT EXISTS, so Postgres can check each row with one index lookup instead of re-scanning all changed objects per row (same change in the balance query). - This helps in case postgres picks a bad plan, where it thinks that there are not much candidate rows, where in reality there is way more of them.Links to any relevant issues
fixes #12536
How the change has been tested
Measured on a staging server with a full testnet copy (921M rows in
checkpointed_objects), across cursors of increasing age (= more objects changed after the viewed checkpoint), queryobjects(first: 3, filter: { type: "0x3::staking_pool::StakedIota" }):The planner estimate for the StakedIota filter went from 1 row to 40,627 (actual 52,458).
The migration took 1m41s on a testnet-size table.
Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure)
Release Notes
objects(filter: { type })no longer times out for types with many objects.