Add some extra indexes for ACL lookups
authorTom Hughes <tom@compton.nu>
Sat, 18 May 2019 11:57:31 +0000 (12:57 +0100)
committerTom Hughes <tom@compton.nu>
Sat, 18 May 2019 11:57:31 +0000 (12:57 +0100)
app/models/acl.rb
db/migrate/20190518115041_add_acl_indexes.rb [new file with mode: 0644]
db/structure.sql

index 095bad8..ea19c74 100644 (file)
@@ -10,7 +10,9 @@
 #
 # Indexes
 #
-#  acls_k_idx  (k)
+#  acls_k_idx             (k)
+#  index_acls_on_address  (address) USING gist
+#  index_acls_on_domain   (domain)
 #
 
 class Acl < ActiveRecord::Base
diff --git a/db/migrate/20190518115041_add_acl_indexes.rb b/db/migrate/20190518115041_add_acl_indexes.rb
new file mode 100644 (file)
index 0000000..a66d820
--- /dev/null
@@ -0,0 +1,6 @@
+class AddAclIndexes < ActiveRecord::Migration[5.2]
+  def change
+    add_index :acls, :domain
+    add_index :acls, :address, :using => :gist, :opclass => :inet_ops
+  end
+end
index 71cc60b..f77c383 100644 (file)
@@ -2063,6 +2063,20 @@ CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
 
 
+--
+-- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
+
+
+--
+-- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
+
+
 --
 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
 --
@@ -2932,6 +2946,7 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('20170222134109'),
 ('20180204153242'),
 ('20181031113522'),
+('20190518115041'),
 ('21'),
 ('22'),
 ('23'),