Add transaction hash to address indexes for transaction and token_transfer tables to optimize count query

pull/753/head
Stamates 6 years ago
parent 4598eba91f
commit bd755fe469
  1. 6
      apps/explorer/priv/repo/migrations/20180117221923_create_transactions.exs
  2. 6
      apps/explorer/priv/repo/migrations/20180606135150_create_token_transfers.exs

@ -182,9 +182,9 @@ defmodule Explorer.Repo.Migrations.CreateTransactions do
)
create(index(:transactions, :block_hash))
create(index(:transactions, :from_address_hash))
create(index(:transactions, :to_address_hash))
create(index(:transactions, :created_contract_address_hash))
create(index(:transactions, [:from_address_hash, :hash]))
create(index(:transactions, [:to_address_hash, :hash]))
create(index(:transactions, [:created_contract_address_hash, :hash]))
create(index(:transactions, :inserted_at))
create(index(:transactions, :updated_at))

@ -23,9 +23,9 @@ defmodule Explorer.Repo.Migrations.CreateTokenTransfers do
end
create(index(:token_transfers, :transaction_hash))
create(index(:token_transfers, :to_address_hash))
create(index(:token_transfers, :from_address_hash))
create(index(:token_transfers, :token_contract_address_hash))
create(index(:token_transfers, [:to_address_hash, :transaction_hash]))
create(index(:token_transfers, [:from_address_hash, :transaction_hash]))
create(index(:token_transfers, [:token_contract_address_hash, :transaction_hash]))
create(unique_index(:token_transfers, [:transaction_hash, :log_index]))
end

Loading…
Cancel
Save