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

Improve the tx queries #1727

Open kderme opened 4 weeks ago

kderme commented 4 weeks ago

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.

kderme commented 2 weeks ago

Some data related to tx_out request pattern

general.txt distribution_2160.txt