11517: Add indexes to help slow queries.
authorTom Clegg <tom@curoverse.com>
Wed, 19 Apr 2017 18:00:01 +0000 (14:00 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 19 Apr 2017 18:00:01 +0000 (14:00 -0400)
services/api/db/migrate/20170419173031_add_created_by_job_task_index_to_job_tasks.rb [new file with mode: 0644]
services/api/db/migrate/20170419173712_add_object_owner_index_to_logs.rb [new file with mode: 0644]
services/api/db/migrate/20170419175801_add_requesting_container_index_to_container_requests.rb [new file with mode: 0644]
services/api/db/structure.sql

diff --git a/services/api/db/migrate/20170419173031_add_created_by_job_task_index_to_job_tasks.rb b/services/api/db/migrate/20170419173031_add_created_by_job_task_index_to_job_tasks.rb
new file mode 100644 (file)
index 0000000..225af45
--- /dev/null
@@ -0,0 +1,5 @@
+class AddCreatedByJobTaskIndexToJobTasks < ActiveRecord::Migration
+  def change
+    add_index :job_tasks, :created_by_job_task_uuid
+  end
+end
diff --git a/services/api/db/migrate/20170419173712_add_object_owner_index_to_logs.rb b/services/api/db/migrate/20170419173712_add_object_owner_index_to_logs.rb
new file mode 100644 (file)
index 0000000..8da78fe
--- /dev/null
@@ -0,0 +1,5 @@
+class AddObjectOwnerIndexToLogs < ActiveRecord::Migration
+  def change
+    add_index :logs, :object_owner_uuid
+  end
+end
diff --git a/services/api/db/migrate/20170419175801_add_requesting_container_index_to_container_requests.rb b/services/api/db/migrate/20170419175801_add_requesting_container_index_to_container_requests.rb
new file mode 100644 (file)
index 0000000..edfddff
--- /dev/null
@@ -0,0 +1,5 @@
+class AddRequestingContainerIndexToContainerRequests < ActiveRecord::Migration
+  def change
+    add_index :container_requests, :requesting_container_uuid
+  end
+end
index e25a2a960571f21b823f14d4d45e619fa2c0ae9a..d6729428beaf00e48e7bceefea2bc1df1fb843b0 100644 (file)
@@ -1730,6 +1730,13 @@ CREATE UNIQUE INDEX index_commits_on_repository_name_and_sha1 ON commits USING b
 CREATE INDEX index_container_requests_on_owner_uuid ON container_requests USING btree (owner_uuid);
 
 
+--
+-- Name: index_container_requests_on_requesting_container_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE INDEX index_container_requests_on_requesting_container_uuid ON container_requests USING btree (requesting_container_uuid);
+
+
 --
 -- Name: index_container_requests_on_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
@@ -1807,6 +1814,13 @@ CREATE UNIQUE INDEX index_humans_on_uuid ON humans USING btree (uuid);
 CREATE INDEX index_job_tasks_on_created_at ON job_tasks USING btree (created_at);
 
 
+--
+-- Name: index_job_tasks_on_created_by_job_task_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE INDEX index_job_tasks_on_created_by_job_task_uuid ON job_tasks USING btree (created_by_job_task_uuid);
+
+
 --
 -- Name: index_job_tasks_on_job_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
@@ -2038,6 +2052,13 @@ CREATE INDEX index_logs_on_event_type ON logs USING btree (event_type);
 CREATE INDEX index_logs_on_modified_at ON logs USING btree (modified_at);
 
 
+--
+-- Name: index_logs_on_object_owner_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE INDEX index_logs_on_object_owner_uuid ON logs USING btree (object_owner_uuid);
+
+
 --
 -- Name: index_logs_on_object_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
@@ -2756,4 +2777,10 @@ INSERT INTO schema_migrations (version) VALUES ('20170301225558');
 
 INSERT INTO schema_migrations (version) VALUES ('20170328215436');
 
-INSERT INTO schema_migrations (version) VALUES ('20170330012505');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20170330012505');
+
+INSERT INTO schema_migrations (version) VALUES ('20170419173031');
+
+INSERT INTO schema_migrations (version) VALUES ('20170419173712');
+
+INSERT INTO schema_migrations (version) VALUES ('20170419175801');
\ No newline at end of file