In addition, we could use a small cache with the most recents txs. An analysis shows that 50% of outputs are consumes within the next 1000 bocks. So if we simply cache the latest 1000 blocks, which is maximum of 50000 txs, we can have a 50% hit-ratio.
The analysis at https://github.com/IntersectMBO/cardano-db-sync/issues/1721 shows that when we query the
tx
table, we unnecesarily get the whole tx instead of simply the id. We could improve this query.In addition, we could use a small cache with the most recents txs. An analysis shows that 50% of outputs are consumes within the next 1000 bocks. So if we simply cache the latest 1000 blocks, which is maximum of 50000 txs, we can have a 50% hit-ratio.