Skip to content

Query for listing expired amulets seems to degrage to seq scan #3192

@moritzkiefer-da

Description

@moritzkiefer-da

Sometimes (when the acs grows large?) the query for listing expired amulets seems to degrade to a sequential scan which then is slow as expected.

Image

The approach we currently use for filtering out dead parties more generally just won't scale as even the best query plan we can get will do a linear filter over the expired amulets to filter out all the ones for dead parties and that list is just gonna keep growing.

Haven't thought too much about approaches for improving it. Adding the party to the index would help I guess but I don't think this magically makes a bunch of party not in increasinglyLongList scale well.

A perhaps better option would be that we have a "unavailable counter party" flag on each contract row that we can set. We then make the index only include contracts with that flag set to false which seems like it would actually give us the right query behavior.

That approach should also work generally for unavailable counter party handling maybe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions