Skip to content

Commit

Permalink
Merge pull request #17 from protofire/staging-harmony
Browse files Browse the repository at this point in the history
Staging harmony
  • Loading branch information
DenSmolonski authored Oct 11, 2024
2 parents 8964069 + 1ea408a commit 186b91f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/explorer/lib/explorer/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,17 @@ defmodule Explorer.Chain do
range_min = min(range_start, range_end)
range_max = max(range_start, range_end)

# Prefix index on blocks(number)
# """
# (
# SELECT distinct b1.number
# FROM generate_series((?)::integer, (?)::integer) AS b1(number)
# WHERE NOT EXISTS
# (SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus)
# ORDER BY b1.number DESC
# )
# """

ordered_missing_query =
from(b in Block,
right_join:
Expand All @@ -2346,7 +2357,7 @@ defmodule Explorer.Chain do
SELECT distinct b1.number
FROM generate_series((?)::integer, (?)::integer) AS b1(number)
WHERE NOT EXISTS
(SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.consensus)
(SELECT 1 FROM blocks b2 WHERE b2.number=b1.number AND b2.epoch IS NULL)
ORDER BY b1.number DESC
)
""",
Expand Down

0 comments on commit 186b91f

Please sign in to comment.