From: Tom Hughes Date: Sat, 18 May 2019 11:57:31 +0000 (+0100) Subject: Add some extra indexes for ACL lookups X-Git-Tag: live~3119 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/8e258d810c8db6e5dccc84fb3292af0e5dd19642 Add some extra indexes for ACL lookups --- diff --git a/app/models/acl.rb b/app/models/acl.rb index 095bad89b..ea19c74b0 100644 --- a/app/models/acl.rb +++ b/app/models/acl.rb @@ -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 index 000000000..a66d820bc --- /dev/null +++ b/db/migrate/20190518115041_add_acl_indexes.rb @@ -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 diff --git a/db/structure.sql b/db/structure.sql index 71cc60baa..f77c3831c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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'),