Skip to content

Adding STRAIGHT_JOIN to SELECT in search query sql#15234

Open
grohli wants to merge 1 commit intohail-is:mainfrom
grohli:batches-query-v2-improvement
Open

Adding STRAIGHT_JOIN to SELECT in search query sql#15234
grohli wants to merge 1 commit intohail-is:mainfrom
grohli:batches-query-v2-improvement

Conversation

@grohli
Copy link
Contributor

@grohli grohli commented Jan 21, 2026

Change Description

Update to a query run when looking at the batches UI page. This change remedies an occasional mysql query planner inefficiency wherein the planner scans over the entire batches table before anything else (e.g., before scanning over the jobs table). Usually this is fine, but on some larger batches this causes the page to take over a minute to load.

Adding STRAIGHT_JOIN to the SELECT statement forces the planner to read the left table before the right table. Here, this means telling the planner to always read the jobs table before the batches table. This avoids any accidentally costly "read the batches table first" plans.

Security Assessment

Delete all except the correct answer:

  • This change potentially impacts the Hail Batch instance as deployed by Broad Institute in GCP

Impact Rating

  • This change has a low security impact

Impact Description

This change is an update to SQL that deals with the batch database, but it's only a performance update and does not change what information is returned to the user when executed.

Appsec Review

  • Required: The impact has been assessed and approved by appsec

@grohli grohli requested a review from a team as a code owner January 21, 2026 18:48
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.

1 participant