Skip to content

Commit

Permalink
remove search index on json fields that harms insert performance
Browse files Browse the repository at this point in the history
  • Loading branch information
dasormeter committed Oct 26, 2021
1 parent b14077a commit 78969f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fe940b22140c0a1da0a3e54c0087c8872828e4cb08bdcc30bbaa1db84f98b62b
b59ca64e25c7ed5abf8c28fa46fc74a04d63b7f6397820b95f20ade0961473e7
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ CREATE INDEX participant_events_divulgence_template_id_idx ON participant_events

-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- Note that Potsgres has trouble using these indices effectively with our paged access.
-- We might decide to drop them.
CREATE SEARCH INDEX participant_events_divulgence_tree_event_witnesses_idx ON participant_events_divulgence (tree_event_witnesses) FOR JSON;
-- Do not enable JSON search indexes for Oracle as they significantly hamper insert times and do not help significantly on read

-- lookup divulgance events, in order of ingestion
CREATE INDEX participant_events_divulgence_contract_id_idx ON participant_events_divulgence(contract_id, event_sequential_id);
Expand Down Expand Up @@ -254,10 +252,7 @@ CREATE INDEX participant_events_create_template_id_idx ON participant_events_cre

-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- Note that Potsgres has trouble using these indices effectively with our paged access.
-- We might decide to drop them.
CREATE SEARCH INDEX participant_events_create_flat_event_witnesses_idx ON participant_events_create (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_create_tree_event_witnesses_idx ON participant_events_create (tree_event_witnesses) FOR JSON;
-- Do not enable JSON search indexes for Oracle as they significantly hamper insert times and do not help significantly on read

-- lookup by contract id
CREATE INDEX participant_events_create_contract_id_idx ON participant_events_create(contract_id);
Expand Down Expand Up @@ -327,8 +322,7 @@ CREATE INDEX participant_events_consuming_exercise_template_id_idx ON participan

-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
CREATE SEARCH INDEX participant_events_consuming_exercise_flat_event_witnesses_idx ON participant_events_consuming_exercise (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_consuming_exercise_tree_event_witnesses_idx ON participant_events_consuming_exercise (tree_event_witnesses) FOR JSON;
-- Do not enable JSON search indexes for Oracle as they significantly hamper insert times and do not help significantly on read

-- lookup by contract id
CREATE INDEX participant_events_consuming_exercise_contract_id_idx ON participant_events_consuming_exercise (contract_id);
Expand Down Expand Up @@ -395,9 +389,7 @@ CREATE INDEX participant_events_non_consuming_exercise_template_id_idx ON partic

-- filtering by witnesses (visibility) for some queries used in the implementation of
-- GetActiveContracts (flat), GetTransactions (flat) and GetTransactionTrees.
-- There is no equivalent to GIN index for oracle, but we explicitly mark as a JSON column for indexing
CREATE SEARCH INDEX participant_events_non_consuming_exercise_flat_event_witness_idx ON participant_events_non_consuming_exercise (flat_event_witnesses) FOR JSON;
CREATE SEARCH INDEX participant_events_non_consuming_exercise_tree_event_witness_idx ON participant_events_non_consuming_exercise (tree_event_witnesses) FOR JSON;
-- Do not enable JSON search indexes for Oracle as they significantly hamper insert times and do not help significantly on read

CREATE VIEW participant_events AS
SELECT cast(0 as SMALLINT) AS event_kind,
Expand Down

0 comments on commit 78969f5

Please sign in to comment.