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

Only update the record when fields have changed for token and metadata programs #187

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

kespinola
Copy link
Collaborator

Context

While observing postgres logs I saw the same record (a collection mint) being updated over and over again from be referenced in bubblegum mint instructions. The fields aren't different on the asset but its slot is updating. When the update happens the row is locked because it has to update indexes. This causes other processes to wait to do the same thing causing a major bottleneck.

Change

Expand the where clause on the update to only update the record when the slot is larger and any of the fields have changed.

@kespinola kespinola force-pushed the only-update-on-change-asset-v1 branch from 25a50dd to bfe005a Compare December 18, 2024 14:17
For the token and metadata program add additional check to only update
the record if the values of the fields have changed and the slot is
larger so the slot column only changes when fields are updated. There
are accounts that are referencd in instructions which trigger account
update but they aren't changed. Every time update statement occurs
indexs are rewritten causing locks. This noop allows insert spam but
skips updating the record and thus no triggering of index updates.
@kespinola kespinola force-pushed the only-update-on-change-asset-v1 branch from bfe005a to 50c0527 Compare December 18, 2024 14:23
@kespinola kespinola merged commit 449eb45 into triton-build Dec 18, 2024
3 checks passed
@kespinola kespinola deleted the only-update-on-change-asset-v1 branch December 18, 2024 14:25
kespinola added a commit that referenced this pull request Dec 18, 2024
kespinola added a commit that referenced this pull request Dec 18, 2024
kespinola added a commit that referenced this pull request Dec 18, 2024
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.

1 participant