10028: add varchar pattern index on logs table object_uuid and owner_uuid columns. 10028-varchar-pattern-indexes
authorradhika <radhika@curoverse.com>
Wed, 26 Oct 2016 14:18:05 +0000 (10:18 -0400)
committerradhika <radhika@curoverse.com>
Wed, 26 Oct 2016 14:18:05 +0000 (10:18 -0400)
services/api/db/migrate/20161026141240_add_varchar_pattern_indices_on_logs.rb [new file with mode: 0644]
services/api/db/structure.sql

diff --git a/services/api/db/migrate/20161026141240_add_varchar_pattern_indices_on_logs.rb b/services/api/db/migrate/20161026141240_add_varchar_pattern_indices_on_logs.rb
new file mode 100644 (file)
index 0000000..63f4a3d
--- /dev/null
@@ -0,0 +1,11 @@
+class AddVarcharPatternIndicesOnLogs < ActiveRecord::Migration
+  def up
+    execute "CREATE INDEX logs_varchar_index_on_object_uuid ON logs (object_uuid varchar_pattern_ops);"
+    execute "CREATE INDEX logs_varchar_index_on_owner_uuid ON logs (owner_uuid varchar_pattern_ops);"
+  end
+
+  def down
+    execute "DROP INDEX logs_varchar_index_on_object_uuid;"
+    execute "DROP INDEX logs_varchar_index_on_owner_uuid;"
+  end
+end
index 0924fc0595b4f02365b4d4330357c30aa286b200..a9442b92761a6780e595af9c6e04579e05eb036a 100644 (file)
@@ -2345,6 +2345,20 @@ CREATE INDEX links_varchar_index_on_tail_uuid ON links USING btree (tail_uuid va
 CREATE INDEX logs_search_index ON logs USING btree (uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, object_uuid, event_type, object_owner_uuid);
 
 
+--
+-- Name: logs_varchar_index_on_object_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE INDEX logs_varchar_index_on_object_uuid ON logs USING btree (object_uuid varchar_pattern_ops);
+
+
+--
+-- Name: logs_varchar_index_on_owner_uuid; Type: INDEX; Schema: public; Owner: -; Tablespace: 
+--
+
+CREATE INDEX logs_varchar_index_on_owner_uuid ON logs USING btree (owner_uuid varchar_pattern_ops);
+
+
 --
 -- Name: nodes_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
@@ -2724,4 +2738,6 @@ INSERT INTO schema_migrations (version) VALUES ('20160926194129');
 
 INSERT INTO schema_migrations (version) VALUES ('20161019171346');
 
-INSERT INTO schema_migrations (version) VALUES ('20161024233727');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20161024233727');
+
+INSERT INTO schema_migrations (version) VALUES ('20161026141240');
\ No newline at end of file