Skip to content

Commit

Permalink
storage: rewrite RuntimeEvmVerifiedContractEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrus committed Dec 18, 2024
1 parent a38130e commit a36b2ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .changelog/838.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Optimize `RuntimeEvmVerifiedContractEvents` query

Optimizes the query by switching DECODE to ENCODE for address comparison
to leverage existing indexes on `chain.runtime_events` table.
2 changes: 1 addition & 1 deletion analyzer/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ var (
JOIN chain.runtime_events as evs ON
evs.type = 'evm.log' AND
evs.runtime = abi_contracts.runtime AND
decode(body->>'address', 'base64') = preimages.address_data
body->>'address' = encode(preimages.address_data, 'base64')
WHERE
(evs.abi_parsed_at IS NULL OR evs.abi_parsed_at < abi_contracts.verification_info_downloaded_at)
LIMIT $2`
Expand Down

0 comments on commit a36b2ae

Please sign in to comment.