Skip to content

Use COPY to speed up ClaimableBalancesChangeProcessor #5086

@tamirms

Description

@tamirms

In #4908 we observed that inserting rows is much faster using the postgres COPY command. We can use this property to improve the performance of the ClaimableBalancesChangeProcessor . The ClaimableBalancesChangeProcessor upserts rows into the claimable_balances and claimable_balance_claimants tables.

However, because claimable balances are either created or removed it turns out that we never have to modify existing rows of claimable_balances and claimable_balance_claimants. The create claimable balance operation creates a claimable balance and the claim operation removes the claimable balance from the ledger. There is no way to mutate a claimable balance once created.

This means we can update the ClaimableBalancesChangeProcessor to use COPY to insert into the the claimable_balances and claimable_balance_claimants tables. We expect that to be faster than the current code which bulk inserts rows into the claimable_balances and claimable_balance_claimants tables.

Metadata

Metadata

Assignees

Labels

performanceissues aimed at improving performance

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions