Skip to content

Commit

Permalink
feat: index tx.data tx_response code and type
Browse files Browse the repository at this point in the history
  • Loading branch information
wgwz committed Aug 16, 2023
1 parent b1b0cb4 commit e782de2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sql/V1_10__all_ecocredit_txes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DROP FUNCTION IF EXISTS all_ecocredit_txes;

CREATE FUNCTION all_ecocredit_txes () RETURNS SETOF tx AS $$
select tx.*
from tx
natural join msg_event_attr as mea
where
data ->'tx_response'->'code' @> '0'
and mea.type like 'regen.ecocredit%'
$$ LANGUAGE SQL STABLE;
1 change: 1 addition & 0 deletions sql/V1_9__index_tx_response_code_and_type.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS tx_data_tx_response_code_idx ON tx USING GIN ((DATA -> 'tx_response' -> 'code'));

0 comments on commit e782de2

Please sign in to comment.