<h3 dir="auto">Description</h3>
<p dir="auto">This PR adds database indexes to improve query performance for the user activity feature as part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2626322073" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5298" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/5298/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/5298">#5298</a>. Specifically, it adds concurrent indexes on:</p>
<ul dir="auto">
<li><code class="notranslate">gpx_files</code> table: <code class="notranslate">[user_id, timestamp]</code> index to optimize retrieval of user's GPS trace uploads</li>
<li><code class="notranslate">notes</code> table: <code class="notranslate">[user_id, created_at]</code> index to optimize retrieval of user's note activities</li>
</ul>
<p dir="auto">These indexes will support efficient querying of user activities without table scans, improving performance for the activity feed implementation.</p>
<h3 dir="auto">How has this been tested?</h3>
<p dir="auto">Testing was performed by:</p>
<ol dir="auto">
<li>Running the migrations locally to verify successful index creation</li>
<li>Checking the database schema to confirm indexes are present</li>
</ol>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5747'>https://github.com/openstreetmap/openstreetmap-website/pull/5747</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747/commits/7796bbf4af9f6e707634f83a16c2517de2c57f87" class="commit-link">7796bbf</a> Add index on gpx_files.user_id and timestamp</li>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747/commits/1f91bdb6656d1f15d22842498e2bcfa38758c817" class="commit-link">1f91bdb</a> Add index on notes.user_id and created_at</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747/files">2 files</a>)</p>
<ul>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747/files#diff-fe33edf41215ad90e177f12f73163584e9a186b4218f91df59e5f757b89c9525">db/migrate/20250304172700_add_gpx_files_user_id_timestamp_index.rb</a>
(7)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747/files#diff-4a84479d92c27aea2d7a2549c17b2f9a6745f5f75a269c80e665f7e3d2716d3f">db/migrate/20250304172701_add_notes_user_id_created_at_index.rb</a>
(7)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5747.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5747.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5747.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5747.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5747">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNT5DRKOJZTJXY6P4D2SUWIHAVCNFSM6AAAAABYIS4BCWVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA4TEOJSGQ2TMNA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLIOJVHX7HQMJQCN7N32SUWIHA5CNFSM6AAAAABYIS4BCWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHKY3UGSQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5747</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5747",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5747",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>