14008: Add container queue index.
authorTom Clegg <tclegg@veritasgenetics.com>
Fri, 24 Aug 2018 15:57:07 +0000 (11:57 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Fri, 24 Aug 2018 16:01:31 +0000 (12:01 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/api/db/migrate/20180824155207_add_queue_index_to_containers.rb [new file with mode: 0644]
services/api/db/structure.sql

diff --git a/services/api/db/migrate/20180824155207_add_queue_index_to_containers.rb b/services/api/db/migrate/20180824155207_add_queue_index_to_containers.rb
new file mode 100644 (file)
index 0000000..7245108
--- /dev/null
@@ -0,0 +1,12 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddQueueIndexToContainers < ActiveRecord::Migration
+  def up
+    ActiveRecord::Base.connection.execute 'CREATE INDEX index_containers_on_queued_state on containers (state, (priority > 0))'
+  end
+  def down
+    ActiveRecord::Base.connection.execute 'DROP INDEX index_containers_on_queued_state'
+  end
+end
index 67f5b21b5d7e122dc663acdd2648870375db9a9f..7a355a5ebab41db7ae2d8f660bc1d259d717abc6 100644 (file)
@@ -1823,10 +1823,10 @@ CREATE UNIQUE INDEX index_collections_on_owner_uuid_and_name ON public.collectio
 
 
 --
--- Name: index_collections_on_portable_data_hash; Type: INDEX; Schema: public; Owner: -
+-- Name: index_collections_on_portable_data_hash_and_trash_at; Type: INDEX; Schema: public; Owner: -
 --
 
-CREATE INDEX index_collections_on_portable_data_hash ON public.collections USING btree (portable_data_hash);
+CREATE INDEX index_collections_on_portable_data_hash_and_trash_at ON public.collections USING btree (portable_data_hash, trash_at);
 
 
 --
@@ -1927,6 +1927,13 @@ CREATE INDEX index_containers_on_modified_at_uuid ON public.containers USING btr
 CREATE INDEX index_containers_on_owner_uuid ON public.containers USING btree (owner_uuid);
 
 
+--
+-- Name: index_containers_on_queued_state; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_containers_on_queued_state ON public.containers USING btree (state, ((priority > 0)));
+
+
 --
 -- Name: index_containers_on_secret_mounts_md5; Type: INDEX; Schema: public; Owner: -
 --
@@ -3137,3 +3144,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180806133039');
 
 INSERT INTO schema_migrations (version) VALUES ('20180820132617');
 
+INSERT INTO schema_migrations (version) VALUES ('20180824155207');
+