18943: Drop redundant indexes
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 1 Apr 2022 21:07:43 +0000 (17:07 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 1 Apr 2022 21:07:43 +0000 (17:07 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

services/api/db/migrate/20220401153101_fix_created_at_indexes.rb
services/api/db/structure.sql

index 5908ab4bc714438aac34a4a4af051409b4236f44..35ed4cd15296cdfe2898f079f36aff5da9191017 100644 (file)
@@ -8,6 +8,7 @@ class FixCreatedAtIndexes < ActiveRecord::Migration[5.2]
   def up
     @@idxtables.each do |table|
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at")
+      ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_uuid")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_and_uuid")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_uuid")
@@ -21,6 +22,7 @@ class FixCreatedAtIndexes < ActiveRecord::Migration[5.2]
   def down
     @@idxtables.each do |table|
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at")
+      ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_uuid")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_and_uuid")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at")
       ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_uuid")
index 2858bba4f2f5ca20d90a9b85251fbb1304e6cbc6..e6bba676257118d542333120a5815549d2cb1f64 100644 (file)
@@ -1911,13 +1911,6 @@ CREATE UNIQUE INDEX index_authorized_keys_on_uuid ON public.authorized_keys USIN
 CREATE INDEX index_collections_on_created_at_and_uuid ON public.collections USING btree (created_at, uuid);
 
 
---
--- Name: index_collections_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_collections_on_created_at_uuid ON public.collections USING btree (created_at, uuid);
-
-
 --
 -- Name: index_collections_on_current_version_uuid_and_version; Type: INDEX; Schema: public; Owner: -
 --
@@ -1995,13 +1988,6 @@ CREATE INDEX index_container_requests_on_container_uuid ON public.container_requ
 CREATE INDEX index_container_requests_on_created_at_and_uuid ON public.container_requests USING btree (created_at, uuid);
 
 
---
--- Name: index_container_requests_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_container_requests_on_created_at_uuid ON public.container_requests USING btree (created_at, uuid);
-
-
 --
 -- Name: index_container_requests_on_modified_at_and_uuid; Type: INDEX; Schema: public; Owner: -
 --
@@ -2114,13 +2100,6 @@ CREATE UNIQUE INDEX index_frozen_groups_on_uuid ON public.frozen_groups USING bt
 CREATE INDEX index_groups_on_created_at_and_uuid ON public.groups USING btree (created_at, uuid);
 
 
---
--- Name: index_groups_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_groups_on_created_at_uuid ON public.groups USING btree (created_at, uuid);
-
-
 --
 -- Name: index_groups_on_delete_at; Type: INDEX; Schema: public; Owner: -
 --
@@ -2380,13 +2359,6 @@ CREATE UNIQUE INDEX index_keep_services_on_uuid ON public.keep_services USING bt
 CREATE INDEX index_links_on_created_at_and_uuid ON public.links USING btree (created_at, uuid);
 
 
---
--- Name: index_links_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_links_on_created_at_uuid ON public.links USING btree (created_at, uuid);
-
-
 --
 -- Name: index_links_on_head_uuid; Type: INDEX; Schema: public; Owner: -
 --
@@ -2443,13 +2415,6 @@ CREATE UNIQUE INDEX index_links_on_uuid ON public.links USING btree (uuid);
 CREATE INDEX index_logs_on_created_at_and_uuid ON public.logs USING btree (created_at, uuid);
 
 
---
--- Name: index_logs_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_logs_on_created_at_uuid ON public.logs USING btree (created_at, uuid);
-
-
 --
 -- Name: index_logs_on_event_at; Type: INDEX; Schema: public; Owner: -
 --
@@ -2625,13 +2590,6 @@ CREATE UNIQUE INDEX index_pipeline_templates_on_uuid ON public.pipeline_template
 CREATE INDEX index_repositories_on_created_at_and_uuid ON public.repositories USING btree (created_at, uuid);
 
 
---
--- Name: index_repositories_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_repositories_on_created_at_uuid ON public.repositories USING btree (created_at, uuid);
-
-
 --
 -- Name: index_repositories_on_modified_at_and_uuid; Type: INDEX; Schema: public; Owner: -
 --
@@ -2723,13 +2681,6 @@ CREATE UNIQUE INDEX index_trashed_groups_on_group_uuid ON public.trashed_groups
 CREATE INDEX index_users_on_created_at_and_uuid ON public.users USING btree (created_at, uuid);
 
 
---
--- Name: index_users_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_users_on_created_at_uuid ON public.users USING btree (created_at, uuid);
-
-
 --
 -- Name: index_users_on_identity_url; Type: INDEX; Schema: public; Owner: -
 --
@@ -2772,13 +2723,6 @@ CREATE UNIQUE INDEX index_users_on_uuid ON public.users USING btree (uuid);
 CREATE INDEX index_virtual_machines_on_created_at_and_uuid ON public.virtual_machines USING btree (created_at, uuid);
 
 
---
--- Name: index_virtual_machines_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_virtual_machines_on_created_at_uuid ON public.virtual_machines USING btree (created_at, uuid);
-
-
 --
 -- Name: index_virtual_machines_on_hostname; Type: INDEX; Schema: public; Owner: -
 --
@@ -2814,13 +2758,6 @@ CREATE UNIQUE INDEX index_virtual_machines_on_uuid ON public.virtual_machines US
 CREATE INDEX index_workflows_on_created_at_and_uuid ON public.workflows USING btree (created_at, uuid);
 
 
---
--- Name: index_workflows_on_created_at_uuid; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX index_workflows_on_created_at_uuid ON public.workflows USING btree (created_at, uuid);
-
-
 --
 -- Name: index_workflows_on_modified_at_and_uuid; Type: INDEX; Schema: public; Owner: -
 --