Skip to content

Add index runs(runner, score)#278

Merged
msaroufim merged 1 commit intomainfrom
benh/RunsIndex
May 6, 2025
Merged

Add index runs(runner, score)#278
msaroufim merged 1 commit intomainfrom
benh/RunsIndex

Conversation

@b9r5
Copy link
Copy Markdown
Collaborator

@b9r5 b9r5 commented May 6, 2025

Description

This adds an index on the runs table to reduce the load time for the main page.

Checklist

Before submitting this PR, ensure the following steps have been completed:

  • Run the slash command /verifyruns on your own server.
    • Run the cluster bot on your server:
      python discord-bot.py
    • Start training runs with the slash command /verifyruns.
    • Verify that the bot eventually responds with:
      ✅ All runs completed successfully!
      
      (It may take a few minutes for all runs to finish. In particular, the GitHub
      runs may take a little longer. The Modal run is typically quick.)
      For more information on running a cluster bot on your own server, see
      README.md.

@b9r5 b9r5 marked this pull request as ready for review May 6, 2025 14:59
@b9r5
Copy link
Copy Markdown
Collaborator Author

b9r5 commented May 6, 2025

This adds an index on the runs table. In my local testing, this reduced the load time for the main page from 2.5 seconds to about 500 ms. The Heroku database servers are a little slower than my local setup, so in Heroku I would expect the load time to go from 3.5 seconds to about 700 ms.

@msaroufim msaroufim requested review from Copilot and msaroufim May 6, 2025 16:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a database migration to add an index on the runs table in order to improve the main page's load time.

  • Added migration file to create an index on leaderboard.runs based on the runner and score columns.
  • Established a dependency on a previous migration to ensure sequence integrity.
Comments suppressed due to low confidence (1)

src/discord-cluster-manager/migrations/20250506_01_38PkG-add-index-on-runs-runner-score.py:10

  • Confirm that the schema 'leaderboard' is the intended target for the runs table, especially if other parts of the system refer to the table without an explicit schema.
step(
        "CREATE INDEX IF NOT EXISTS runs_runner_score_idx ON leaderboard.runs(runner, score)",

@msaroufim msaroufim merged commit 58dba8a into main May 6, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants