Skip to content

db: change the way not cloned repos are fetched from DB

Warren Gifford requested to merge ao/remove-anti-join-with-gitserver_repos into main

Created by: sashaostrikov

Previous version of SQL predicate was checking for non-existent rows in gitserver_repos table (gr.clone_status IS NULL) which resulted in a slow anti-join with gitserver_repos table.

This join was used to list not cloned repos, but it is no longer needed because there in no possibility of having a repo which has an entry in repo table and doesn't have an entry in gitserver_repos table.

The trigger was added in https://github.com/sourcegraph/sourcegraph/pull/35633 which makes these two tables strictly consistent between each other.

Part of https://github.com/sourcegraph/sourcegraph/issues/34110

Test plan

Existing tests should pass

Merge request reports

Loading