[openstreetmap/openstreetmap-website] Activity indexes (PR #5747)

Emin Kocan notifications at github.com
Tue Mar 4 04:50:11 UTC 2025


### Description

This PR adds database indexes to improve query performance for the user activity feature as part of #5298. Specifically, it adds concurrent indexes on:

- `gpx_files` table: `[user_id, timestamp]` index to optimize retrieval of user's GPS trace uploads
- `notes` table: `[user_id, created_at]` index to optimize retrieval of user's note activities

These indexes will support efficient querying of user activities without table scans, improving performance for the activity feed implementation.

### How has this been tested?

Testing was performed by:
1. Running the migrations locally to verify successful index creation
2.  Checking the database schema to confirm indexes are present

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5747

-- Commit Summary --

  * Add index on gpx_files.user_id and timestamp
  * Add index on notes.user_id and created_at

-- File Changes --

    A db/migrate/20250304172700_add_gpx_files_user_id_timestamp_index.rb (7)
    A db/migrate/20250304172701_add_notes_user_id_created_at_index.rb (7)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5747.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5747.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5747
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5747 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250303/a7ce2e7e/attachment.htm>


More information about the rails-dev mailing list