From ef92e47c6b9ee703cbfd98fa8d265b2eb5476ca8 Mon Sep 17 00:00:00 2001 From: Tim Mecklem Date: Mon, 4 Jun 2018 16:06:02 -0400 Subject: [PATCH] Remove unnecessary joins to blocks table Co-authored-by: Stamates --- apps/explorer/lib/explorer/chain.ex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index f490dd73f0..b2edd2c412 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -1639,13 +1639,11 @@ defmodule Explorer.Chain do {:ok, hash} -> from( transaction in query, - inner_join: block in assoc(transaction, :block), join: hash_transaction in Transaction, on: hash_transaction.hash == ^hash, - inner_join: hash_block in assoc(hash_transaction, :block), where: - block.number > hash_block.number or - (block.number == hash_block.number and transaction.index > hash_transaction.index) + transaction.block_number > hash_transaction.block_number or + (transaction.block_number == hash_transaction.block_number and transaction.index > hash_transaction.index) ) :error ->