Inventory tab for ERC721 doesn't load any token transfers because query is timing out. Looking into the query, it does a couple of unnessary joins: 1. with `transactions` for `block_number`. But token_transfers already have block_number 2. with `tokens` to check if `token_transfers` are for ERC-721 token. But the query is only executed only for ERC 721 tokens One more issue that I found is that the query uses distinct by `token_id`. But we don't have any indexes on `token_id`. So this PR adds index on `token_id`.pull/2635/head
parent
81d2b10959
commit
eef64e47b5
@ -0,0 +1,7 @@ |
||||
defmodule Explorer.Repo.Migrations.AddIndexOnTokenTransferTokenId do |
||||
use Ecto.Migration |
||||
|
||||
def change do |
||||
create_if_not_exists(index(:token_transfers, [:token_id])) |
||||
end |
||||
end |
Loading…
Reference in new issue