From: Peter Amstutz Date: Fri, 27 Oct 2017 18:42:03 +0000 (-0400) Subject: Migration for indexes on containers and container_requests. X-Git-Tag: 1.1.1~27 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/36d2b2d633801cdeff4bb92d906e48e80042139c Migration for indexes on containers and container_requests. refs #12500 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/services/api/db/migrate/20171027183824_add_index_to_containers.rb b/services/api/db/migrate/20171027183824_add_index_to_containers.rb new file mode 100644 index 0000000000..d90011c7c1 --- /dev/null +++ b/services/api/db/migrate/20171027183824_add_index_to_containers.rb @@ -0,0 +1,11 @@ +class AddIndexToContainers < ActiveRecord::Migration + def up + ActiveRecord::Base.connection.execute("CREATE INDEX index_containers_on_modified_at_uuid ON containers USING btree (modified_at desc, uuid asc)") + ActiveRecord::Base.connection.execute("CREATE INDEX index_container_requests_on_container_uuid on container_requests (container_uuid)") + end + + def down + ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_containers_on_modified_at_uuid") + ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_container_requests_on_container_uuid") + end +end diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql index 2d078f3b7c..e062d43e4b 100644 --- a/services/api/db/structure.sql +++ b/services/api/db/structure.sql @@ -1827,6 +1827,13 @@ CREATE UNIQUE INDEX index_commit_ancestors_on_descendant_and_ancestor ON commit_ CREATE UNIQUE INDEX index_commits_on_repository_name_and_sha1 ON commits USING btree (repository_name, sha1); +-- +-- Name: index_container_requests_on_container_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_container_requests_on_container_uuid ON container_requests USING btree (container_uuid); + + -- -- Name: index_container_requests_on_modified_at_uuid; Type: INDEX; Schema: public; Owner: - -- @@ -1855,6 +1862,13 @@ CREATE INDEX index_container_requests_on_requesting_container_uuid ON container_ CREATE UNIQUE INDEX index_container_requests_on_uuid ON container_requests USING btree (uuid); +-- +-- Name: index_containers_on_modified_at_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_containers_on_modified_at_uuid ON containers USING btree (modified_at DESC, uuid); + + -- -- Name: index_containers_on_owner_uuid; Type: INDEX; Schema: public; Owner: - -- @@ -3016,3 +3030,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170824202826'); INSERT INTO schema_migrations (version) VALUES ('20170906224040'); +INSERT INTO schema_migrations (version) VALUES ('20171027183824'); +