Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak block indexing to use height as the primary key #4757

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

cronokirby
Copy link
Contributor

Every block has a unique height, we almost always want to join with other tables based on block height, the serial ID has no meaning: ergo, we should get rid of the id, and just use height as the primary key.

There was no index on height either, which would have made joining on it slow.

Also removed unwraps and expects and as in favor of actual errors.

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    Indexer changes

Every block has a unique height, we almost always want to join with
other tables based on block height, the serial ID has no meaning: ergo,
we should get rid of the id, and just use height as the primary key.

There was no index on height either, which would have made joining on it
slow.

Also removed unwraps and expects and as in favor of actual errors.
Copy link
Contributor

@aubrika aubrika left a comment

Choose a reason for hiding this comment

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

good change 👍🏻

@cronokirby cronokirby merged commit 21b8d7f into main Jul 24, 2024
13 checks passed
@cronokirby cronokirby deleted the pindexer-block-height-primary-key branch July 24, 2024 22:20
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