augur icon indicating copy to clipboard operation
augur copied to clipboard

Consider adding an index to pull_request_files on the repo_id

Open cdolfi opened this issue 6 months ago • 3 comments

Consider adding index on repo_id to all the main tables

cdolfi avatar Jun 03 '25 16:06 cdolfi

The repo_id is a foreign key nearly everywhere it is used outside of the repo table itself.

Adding an index here makes sense. Are there other tables where its also possibly useful?

sgoggins avatar Jun 08 '25 22:06 sgoggins

check on pull_request_reviews as well

cdolfi avatar Jun 09 '25 14:06 cdolfi

Check on all the main tables if there is an index on repo_id

cdolfi avatar Jun 09 '25 14:06 cdolfi

@MoralCode Sir I think this can be closed now as #3184 is mentioned

PredictiveManish avatar Nov 09 '25 05:11 PredictiveManish

Looking at the source code behind that PR, it doesnt seem to add an index - it just adds a unique constraint to some of the columns.

I believe this still needs to be done

MoralCode avatar Nov 10 '25 16:11 MoralCode

@MoralCode I believe adding a unique constraint in Postgres also makes it a unique index: https://www.postgresql.org/docs/current/indexes-unique.html. From the doc:

PostgreSQL automatically creates a unique index when a unique constraint or primary key is defined for a table. The index covers the columns that make up the primary key or unique constraint (a multicolumn index, if appropriate), and is the mechanism that enforces the constraint.

shlokgilda avatar Nov 12 '25 07:11 shlokgilda

that seems to check out, even on postgres 16 (the version we are on). Closing.

MoralCode avatar Nov 12 '25 23:11 MoralCode