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

storage/consensus: Update indexes to better serve the related accounts queries #890

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Jan 19, 2025

Fixes/mitigations for: #882
Fixes: #883

The ix_transactions_method_height was missing the tx_index, so the query optimizer didn't do the top-n optimization for consensus related accounts query with filters on method. The indexes on both tables now match on the fields and ordering, so this should be fixed.

For the https://nexus.oasis.io/v1/consensus/accounts/oasis1qrg3zwe9gvkvs6dvrytr3dedyyjyxp6kgv8u2m2m counting the huge number of related transactions appears to be problematic:

AccountStats = `
SELECT
COUNT(*)
FROM chain.accounts_related_transactions
WHERE account_address = $1::text`
hopefully the increased timeout fixes this. Otherwise we should probably move this computation into the accounts_list view, and fetch it from there.

The last query is using the indexes as expected, it just takes long due the table being huge. Hopefully, the increased timeout helps. In future we should check if there's any db setting optimizations to be done.

@ptrus ptrus force-pushed the ptrus/feature/related-txs-idx branch from 5c407ba to fba9b10 Compare January 19, 2025 13:40
@ptrus ptrus force-pushed the ptrus/feature/related-txs-idx branch from fba9b10 to bfd8eb5 Compare January 19, 2025 14:58
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.

Expose the is_likely_native_token_transfer flag for runtime tx method filtering
1 participant