Skip to content

Add indexes for NFTs efficient queries#252

Open
nicov-iov wants to merge 1 commit intodevelopfrom
feat/dx-38-support-nfts-display
Open

Add indexes for NFTs efficient queries#252
nicov-iov wants to merge 1 commit intodevelopfrom
feat/dx-38-support-nfts-display

Conversation

@nicov-iov
Copy link
Copy Markdown
Collaborator

@nicov-iov nicov-iov commented Apr 10, 2026

This pull request updates the database schema to improve support for NFTs by adding new indexes to the event table. These changes are reflected in both the raw SQL schema and the Prisma schema definition, which will help optimize queries related to NFT events.

NFT support and indexing improvements:

  • Added three new indexes to the event table in both prisma/rsk-explorer-database.sql and prisma/schema.prisma to optimize queries for NFT-related data:
    • Index on (address, topic0, topic3, block_number DESC, log_index DESC) to speed up lookups involving NFT transfer events. [1] [2]
    • Index on (topic0, topic1) to optimize event queries by topic. [1] [2]
    • Index on (topic0, topic2) for further event filtering efficiency. [1] [2]

Documentation:

  • Updated database schema version and notes to reflect the addition of NFT-related indexes.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Copy link
Copy Markdown

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

Adds support for persisting ERC-721 token metadata by introducing an nft_metadata model to the Prisma schema (intended to correspond to a new nft_metadata table in Postgres).

Changes:

  • Add nft_metadata Prisma model with composite primary key (contract, tokenId)
  • Map select camelCase fields to snake_case DB columns (token_id, token_uri, fetched_at)

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

Comment thread prisma/schema.prisma Outdated
Comment thread prisma/schema.prisma Outdated
@nicov-iov nicov-iov force-pushed the feat/dx-38-support-nfts-display branch from 598bb4a to cb9be30 Compare April 14, 2026 01:40
@nicov-iov nicov-iov requested a review from ivegabr April 14, 2026 01:41
@nicov-iov nicov-iov force-pushed the feat/dx-38-support-nfts-display branch from d751436 to 1d9cf78 Compare April 17, 2026 13:30
@nicov-iov nicov-iov changed the title chore: add nft_metadata table and test block indexing script Add indexes for NFTs efficient queries Apr 17, 2026
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.

2 participants