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

Optimize GraphQL "balances" query #1965

Closed
xgreenx opened this issue Jun 14, 2024 · 5 comments · Fixed by #2383
Closed

Optimize GraphQL "balances" query #1965

xgreenx opened this issue Jun 14, 2024 · 5 comments · Fixed by #2383
Assignees

Comments

@xgreenx
Copy link
Collaborator

xgreenx commented Jun 14, 2024

The source of this issue is #623.

Initially, the idea was to remove all complex queries from fuel-core and make it part of the indexer's responsibility. But the SDK is deeply integrated with these basic queries, that we need to support them on fuel-core. For that, we need to optimize the following queries by aggregating some information in the off-chain worker or adding new indexes to the database:

  • The balance and balances queries iterate over all entries of coins and messages in the storage. The off-chain worker should index the balance of each account and aggregate this information in a user-friendly form.
  • The coins_to_spend query is very complex and requires n^2 operations where n is the number of coins and messages. The algorithm itself can use additional indexes from RocksDB to solve the issue with dust coins and works fast.
  • The dry_run already allows the dry running of many transactions; we just need to forbid several dry run sub-queries inside of one query.
@rafal-ch rafal-ch self-assigned this Oct 14, 2024
@rafal-ch
Copy link
Contributor

#2032 (comment)

@rafal-ch rafal-ch mentioned this issue Oct 14, 2024
9 tasks
@netrome
Copy link
Contributor

netrome commented Oct 17, 2024

Initially, the idea was to remove all complex queries from fuel-core and make it part of the indexer's responsibility. But the SDK is deeply integrated with these basic queries, that we need to support them on fuel-core.

Perhaps we should consider feature gating more complex queries so that node operators can choose to support them or not. This would allow node operators to opt for running a more lightweight node if they don't need to support these queries, and app developers can connect to nodes supporting the complex queries if they need them.

@netrome
Copy link
Contributor

netrome commented Oct 17, 2024

Perhaps we should consider feature gating more complex queries so that node operators can choose to support them or not. This would allow node operators to opt for running a more lightweight node if they don't need to support these queries, and app developers can connect to nodes supporting the complex queries if they need them.

Oh I noticed we have an issue for this already #1569

@rafal-ch
Copy link
Contributor

The "coins to spend" issue was extracted into: #2391

@rafal-ch
Copy link
Contributor

The "dry run" issue was extracted into: #2392

@rafal-ch rafal-ch changed the title Optimize GraphQL queries by adding additional indexes on DB level Optimize GraphQL "balances" query Oct 24, 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 a pull request may close this issue.

3 participants