sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.28k forks source link

Investigate approaches to speed up ListSourcegraphDotComIndexableRepos query #55157

Closed incident-io[bot] closed 9 months ago

incident-io[bot] commented 1 year ago

The query runs for more than 5 minutes on dotcom and this means any migrations on the repo or the gitserver_repos table will timeout if a deployment is triggered while the query is already running.

With dotcom's unique scale in terms of number of repos we should explore options to speed this up or break into batches so that migration jobs do not fail.

Since this query does not run on customer instances, we expect this to only be an issue with dotcom for the time being.


This action was created from Incident 223 by Indradhanush Gupta, using incident.io 🔥

/cc @sourcegraph/source

github-actions[bot] commented 1 year ago

Hey, @sourcegraph/code-search - Batch Changes has been mentioned. Let's take a look.

indradhanush commented 1 year ago

Screenshot from CloudSQL at the time the migration failed.

image

See it here.

efritz commented 1 year ago

Maybe we shouldn't return every row? Why don't we batch/paginate here?

eseliger commented 1 year ago

We could, but we need the full list before returning. It it reduces lock contention, multiple requests for smaller batches might still help, at the cost of slightly higher overall cost, probably.