Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
speed up validation plan runs by adding an appropriate index
Browse files Browse the repository at this point in the history
..which is used to determine if a suitable validation_result record already
exists, before creating a new one
  • Loading branch information
karenetheridge committed Aug 2, 2019
1 parent a4e3ca1 commit 40852cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sql/migrations/0092-validation_result-index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT run_migration(92, $$

-- this is used when inserting validation_state + validation_state_member +
-- validation_result records at the end of running a validation_plan and we seek
-- to re-use old records where possible instead of creating a new ones
create index validation_result_all_columns_idx on validation_result
(device_id, hardware_product_id, validation_id, message, hint, status, category, component_id, result_order);

$$);
7 changes: 7 additions & 0 deletions sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,13 @@ CREATE INDEX validation_plan_member_validation_plan_id_idx ON public.validation_
CREATE UNIQUE INDEX validation_plan_name_idx ON public.validation_plan USING btree (name) WHERE (deactivated IS NULL);


--
-- Name: validation_result_all_columns_idx; Type: INDEX; Schema: public; Owner: conch
--

CREATE INDEX validation_result_all_columns_idx ON public.validation_result USING btree (device_id, hardware_product_id, validation_id, message, hint, status, category, component_id, result_order);


--
-- Name: validation_result_device_id_idx; Type: INDEX; Schema: public; Owner: conch
--
Expand Down

0 comments on commit 40852cb

Please sign in to comment.