Until this point in time we maintained stateless indexing, where no information was passed from one block handler to another, but with the recent performance degradation I believe it is time to introduce some caching layer to potentially avoid SELECTing from the database in the most cases. Currently, the major contributor to the IO wait is the query that tries to find the parent receipt/transaction:
If we maintain the cache of the parent receipt/transaction, and only fallback to SELECTing form the database when we don't have the information in our cache, we will gain quite some performance boost.
Until this point in time we maintained stateless indexing, where no information was passed from one block handler to another, but with the recent performance degradation I believe it is time to introduce some caching layer to potentially avoid SELECTing from the database in the most cases. Currently, the major contributor to the IO wait is the query that tries to find the parent receipt/transaction:
https://github.com/near/near-indexer-for-explorer/blob/1a0739806f6ef605dd6cf77744c2bdfbc07bd941/src/db_adapters/receipts.rs#L199-L224
If we maintain the cache of the parent receipt/transaction, and only fallback to SELECTing form the database when we don't have the information in our cache, we will gain quite some performance boost.