You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should add a column latest_tx_timestamp to the address_balance and update it whenever a new tx arrives (with the token for the address in question) or in the case of a re-org.
Motivation
The explorer-service queries for an address tokens ordered by most recent activity, the query made in this PR works very well but can be slow when the address has too many transactions since it requires the MAX(timestamp).
We would have 2 solutions, making an index on the timestamp column of the address_tx_history table or having the latest transaction timestamp "saved" on the address_balance table.
Both solutions can solve the issue but the first one still requires the explorer-service to make a sub-query on the address_tx_history table while the second get the same information in a more straightforward manner.
The text was updated successfully, but these errors were encountered:
Summary
We should add a column
latest_tx_timestamp
to the address_balance and update it whenever a new tx arrives (with the token for the address in question) or in the case of a re-org.Motivation
The explorer-service queries for an address tokens ordered by most recent activity, the query made in this PR works very well but can be slow when the address has too many transactions since it requires the
MAX(timestamp)
.We would have 2 solutions, making an index on the
timestamp
column of theaddress_tx_history
table or having the latest transaction timestamp "saved" on theaddress_balance
table.Both solutions can solve the issue but the first one still requires the explorer-service to make a sub-query on the
address_tx_history
table while the second get the same information in a more straightforward manner.The text was updated successfully, but these errors were encountered: