Skip to content

fix(query): avoid eager UID materialization on posting reads - #9809

Open
gooohgb wants to merge 1 commit into
dgraph-io:mainfrom
gooohgb:fix-calculated-uids-materialization
Open

fix(query): avoid eager UID materialization on posting reads#9809
gooohgb wants to merge 1 commit into
dgraph-io:mainfrom
gooohgb:fix-calculated-uids-materialization

Conversation

@gooohgb

@gooohgb gooohgb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

Related @matthewmcneely : #9807

This PR avoids eagerly materializing the full UID slice for posting lists on read paths where that work is not useful or actively bypasses existing optimizations.

Changes:

  • Gate calculateUids() behind the posting-list cache being enabled, so --cache percentage=0,... does not build and immediately discard a full []uint64.
  • Avoid using calculatedUids for bounded Uids() reads with First or Intersect, preserving early-stop and compressed-intersection paths.
  • Reduce Uids() allocation size for bounded and small-intersect reads.
  • Avoid GetUids() in worker paths that do not consume a full UID list, including count, scalar comparison, has, uid_in, facets, pagination, and intersect paths.

Checklist

  • The PR title follows the
    Conventional Commits syntax, leading
    with fix:, feat:, chore:, ci:, etc.
  • Code compiles correctly and linting (via trunk) passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@gooohgb
gooohgb requested a review from a team as a code owner August 6, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant