]> git.openstreetmap.org Git - rails.git/commitdiff
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 095bad89b942d07e62ee74b18e999100905c456b..ea19c74b0f0082302ed9b740525377c58bd15b6c 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 71cc60baaf9e514b9dd65db0eb8b011b52682edb..f77c3831c260d276ce6dd37f303df6f9d8b8b65c 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'),