IntersectMBO / cardano-db-sync

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL
Apache License 2.0
283 stars 158 forks source link

1727 - Improve Tx queries performance #1756

Open Cmdv opened 3 days ago

Cmdv commented 3 days ago

Description

This fixes #1727

TODO:

Checklist

Migrations

If there is a breaking change, especially a big one, please add a justification here. Please elaborate more what the migration achieves, what it cannot achieve or why a migration is not possible.

kderme commented 3 days ago

Any ideas on how the eviction of old data will work?

Cmdv commented 1 day ago

@kderme I'm making it an LRU so they'll just get pushed out if they haven't gotten used. Will be easier than trying to work out when a TxId in the cache should be deleted.

kderme commented 15 hours ago

We should somehow handle rollbacks, since tx table is deleted on rollbacks. I think we can follow a very simple approach, simply delete the whole TxCache when there is a rollback, as part of rollbackCache.