Skip to content

Refactor upsert_accounts to reduce database round-trips #1483

@SantiagoPittella

Description

@SantiagoPittella

Not for this PR, but this method has gotten pretty complicated with multiple requests to the database being made. Let's create an issue to refactor it so that we issue only one read and one write request during this method (I think this should be enough).

Originally posted by @bobbinth in #1452 (comment)

upsert_accounts currently issues multiple database queries per account in a loop (reads for created_at_block and existing account details, writes for codes, accounts, storage maps, and vault assets).
Refactor to batch all reads into one query and all writes into one batch operation to improve performance and simplify the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    storeRelated to the store component

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions