|
|
|
@ -20,6 +20,7 @@ defmodule Explorer.Chain do |
|
|
|
|
|
|
|
|
|
import EthereumJSONRPC, only: [integer_to_quantity: 1] |
|
|
|
|
|
|
|
|
|
alias Ecto.Adapters.SQL |
|
|
|
|
alias Ecto.{Changeset, Multi} |
|
|
|
|
|
|
|
|
|
alias Explorer.Chain.{ |
|
|
|
@ -1898,7 +1899,16 @@ defmodule Explorer.Chain do |
|
|
|
|
""" |
|
|
|
|
@spec transaction_estimated_count() :: non_neg_integer() |
|
|
|
|
def transaction_estimated_count do |
|
|
|
|
TransactionCountCache.value() |
|
|
|
|
cached_value = TransactionCountCache.value() |
|
|
|
|
|
|
|
|
|
if is_nil(cached_value) do |
|
|
|
|
%Postgrex.Result{rows: [[rows]]} = |
|
|
|
|
SQL.query!(Repo, "SELECT reltuples::BIGINT AS estimate FROM pg_class WHERE relname='transactions'") |
|
|
|
|
|
|
|
|
|
rows |
|
|
|
|
else |
|
|
|
|
cached_value |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
|