Skip to content

fix: add domain.name indexes to subgraph schema#1856

Draft
shrugs wants to merge 1 commit intomainfrom
fix/name-index
Draft

fix: add domain.name indexes to subgraph schema#1856
shrugs wants to merge 1 commit intomainfrom
fix/name-index

Conversation

@shrugs
Copy link
Copy Markdown
Collaborator

@shrugs shrugs commented Mar 31, 2026

references #1819

Summary

Out of Scope

  • GIN trigram index (gin_trgm_ops) for partial match operations (_contains, _starts_with, _ends_with)
    • requires pg_trgm extension, which is obviously available, but not sure how best to ensure that the CREATE EXTENSION IF NOT EXISTS pg_trgm command is executed before ponder applies indexes. maybe could be part of ensdbwriterworker?

Copilot AI review requested due to automatic review settings March 31, 2026 20:41
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: be4e92e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Mar 31, 2026 8:41pm
ensnode.io Skipped Skipped Mar 31, 2026 8:41pm
ensrainbow.io Skipped Skipped Mar 31, 2026 8:41pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

Updated the subgraph_domain table's index configuration by removing a previously disabled byName index and adding a new byExactName hash index on the name column. Other existing indexes on labelhash, parentId, ownerId, registrantId, wrappedOwnerId, and resolvedAddressId remain unchanged.

Changes

Cohort / File(s) Summary
Index Configuration Update
packages/ensdb-sdk/src/ensindexer-abstract/subgraph.schema.ts
Replaced disabled byName index with new byExactName hash index on t.name in the subgraph_domain table.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 An index grew too large, you see,
So hash we hash instead of B-tree!
Exact names indexed with care,
Swift queries dance through data fair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides a clear summary of changes, references a related issue, and explains the rationale. However, the Testing and Pre-Review Checklist sections required by the template are completely missing. Add the 'Testing' section explaining how this change was tested, and complete the 'Pre-Review Checklist' with checkmarks for both blocking items or explanations if not applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding domain.name indexes to the subgraph schema, which matches the core modification in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/name-index

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Re-enables an index on subgraph_domains.name in the ENS subgraph-compatible Ponder/Drizzle schema, switching from a btree index to a hash index to avoid Postgres’ btree index-row size limit when spam/oversized names are present.

Changes:

  • Add a hash index on subgraph_domains.name (byExactName) to support exact-match lookups without hitting the btree 8191-byte limit.
  • Remove the prior commented-out/disabled byName index block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// For more details, see: https://github.com/namehash/ensnode/issues/1819
// byName: index().on(t.name),
// uses a hash index because some name values exceed the btree max row size (8191 bytes)
byExactName: index().using("hash", t.name),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
byExactName: index().using("hash", t.name),
byExactName: index().using("hash").on(t.name),

Incorrect hash index syntax: index().using("hash", t.name) passes column as second parameter instead of using .on() method

Fix on Vercel

@tk-o
Copy link
Copy Markdown
Contributor

tk-o commented Apr 1, 2026

The update looks good to me 👍 As discussed on Slack, it'd great to enable the pg_trgm extension for ENSDb within the prepareIndexingSetup function that will be added in PR #1843.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants