Skip to content

[bot] Merge 26.11 to develop - #791

Merged
github-actions[bot] merged 4 commits into
developfrom
fb_bot_merge_26.11
Nov 24, 2026
Merged

github-actions[bot] merged 4 commits into
developfrom
fb_bot_merge_26.11

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Generated automatically.
Merging changes from: da894bc
Approve all matching PRs simultaneously.
Approval will trigger automatic merge.
Verify all PRs before approving: https://internal.labkey.com/Scrumtime/Backlog/harvest-gitOpenPullRequests.view?branch=fb_bot_merge_26.11

labkey-martyp and others added 4 commits November 17, 2026 04:29
## Rationale

This PR fixes a severe slowdown when the Necropsies grid
(`nirc_ehr.necropsyTasks`) includes `animalId.lastHousing`,
`lastProject`, or `lastProtocol` columns. Those queries joined each
dataset to its own `max(date)` aggregate, which Postgres underestimated
by ~3000x (13 rows vs. 40k) and executed as an unindexed nested loop:
14.4s on a production-sized database, ~13s of it in that one join.

## Related Pull Requests

None.

## Changes

- Find each animal's latest housing, project, and protocol row with an
anti-join instead of a self-join on the aggregate, which Postgres
estimates and plans correctly.
- `enddate` on these lookups is now the latest row's own end date rather
than the largest end date across all rows, so an animal whose latest
record is open now shows no end date.
- Verified the housing rewrite against production data: it plans as a
hash anti-join and returns the same 40,413 rows as before in 0.85s. The
full Necropsies grid timing with the change has not been measured yet.
## Rationale

Shows the projects and protocols an animal was assigned to on each
dataset record's date, alongside Housing At Time.

## Related Pull Requests

-
[LabKey/ehrModules#1248](LabKey/ehrModules#1248)
(shared columns; merge together)

## Changes

- Every dataset except demographics gets Project At Time and Protocol At
Time, each value linking to its project or protocol details.
@github-actions
github-actions Bot merged commit 987d298 into develop Nov 24, 2026
7 checks passed
@github-actions
github-actions Bot deleted the fb_bot_merge_26.11 branch November 24, 2026 15:05
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