Skip to content

Improve multi_asset table #1065

@kderme

Description

@kderme

ma_tx_out is by far the most populated table (~165M entries on epoch 319). It also references the multi_asset table.

We can improve performance here. Two ideas:

  • We query the multiasset and only if it doesn't exist we insert it. Querying only requires policyId and name, which compose the unique key. Most probably the query will always succeed, since minting comes first.
  • We can cache a mapping of (policyId, name) -> MultiAssetId. There are 3.2M entries of multi_asset on epoch 319, so this seems like a good bargain: 3.2M entries in memory to avoid 165M queries.

Also multi_asset doesn't have any OnDeleteCascade fields, so on a rollback the db is left with unnecessary fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions