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

add index for chain.addres_preimages.address_data #498

Merged
merged 3 commits into from Aug 7, 2023

Conversation

Andrew7234
Copy link
Collaborator

@lukaw3d pointed out that the /events endpoint was slow. Root cause was the left join on address_preimages in order to look up token-specific information for events.

Copy link
Collaborator

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

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

I always approve these sort of changes that describe what's already done

🥲 here's us using a database table to compute a hash

Copy link
Collaborator

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

Thank you!

Just stating what we've discussed between the lines: The cleaner alternative would be to compute the hash in postgres.

My understanding is that the hash in question is keccak-256 here. It is potentially accessible in postgres via the no-root-required pgcrypto extension, which "supports all digest algorithms supported by OpenSSL". OpenSSL added support for keccak-256 back in Sept 2020, but at least my local install doesn't support it yet (openssl list -digest-algorithms and openssl version), nor does the one in our docker images. So this relatively ugly index is probably the right call :)

storage/client/queries/queries.go Show resolved Hide resolved
@Andrew7234 Andrew7234 merged commit 983a647 into main Aug 7, 2023
6 checks passed
@Andrew7234 Andrew7234 deleted the andrew7234/preimage-data-index branch August 7, 2023 22:04
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.

None yet

3 participants