diff --git a/sql/migrations/0092-validation_result-index.sql b/sql/migrations/0092-validation_result-index.sql new file mode 100644 index 000000000..897c81eb8 --- /dev/null +++ b/sql/migrations/0092-validation_result-index.sql @@ -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); + +$$); diff --git a/sql/schema.sql b/sql/schema.sql index 9b6234a25..0b0cf92e9 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -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 --