From: Tom Clegg Date: Fri, 24 Aug 2018 15:57:07 +0000 (-0400) Subject: 14008: Add container queue index. X-Git-Tag: 1.3.0~123^2~2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/572601ef7712342e599e2b2abf22268f8f378b07 14008: Add container queue index. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- 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 index 0000000000..7245108717 --- /dev/null +++ b/services/api/db/migrate/20180824155207_add_queue_index_to_containers.rb @@ -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 diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql index 67f5b21b5d..7a355a5eba 100644 --- a/services/api/db/structure.sql +++ b/services/api/db/structure.sql @@ -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'); +