Add index on gpx_files table on user_id, id

This commit is contained in:
Emin Kocan 2025-03-04 05:37:53 +01:00
parent a6e3f47f03
commit 227894193d
3 changed files with 19 additions and 3 deletions

View file

@ -16,9 +16,10 @@
# #
# Indexes # Indexes
# #
# gpx_files_timestamp_idx (timestamp) # gpx_files_timestamp_idx (timestamp)
# gpx_files_user_id_idx (user_id) # gpx_files_user_id_idx (user_id)
# gpx_files_visible_visibility_idx (visible,visibility) # gpx_files_visible_visibility_idx (visible,visibility)
# index_gpx_files_on_user_id_and_id (user_id,id)
# #
# Foreign Keys # Foreign Keys
# #

View file

@ -0,0 +1,7 @@
class AddGpxFilesUserIdIdIndex < ActiveRecord::Migration[7.2]
disable_ddl_transaction!
def change
add_index :gpx_files, [:user_id, :id], :algorithm => :concurrently
end
end

View file

@ -2463,6 +2463,13 @@ CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_e
CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at); CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
--
-- Name: index_gpx_files_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_gpx_files_on_user_id_and_id ON public.gpx_files USING btree (user_id, id);
-- --
-- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: - -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
-- --
@ -3429,6 +3436,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('23'), ('23'),
('22'), ('22'),
('21'), ('21'),
('20250304172758'),
('20250212160355'), ('20250212160355'),
('20250206202905'), ('20250206202905'),
('20250121191749'), ('20250121191749'),