perf(discovery): batch suggestSimilarInstances thumbnail resolution (ISSUE-140) #1146
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-140-suggest-thumb-latency"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PR#1144 introduced a latency regression in the media-viewer "Assign person" dropdown:
REPRESENTATIVE_FACE_THUMBNAIL_SUBQUERYwas interpolated into the embedding-path candidate-rows statement ofsuggestSimilarInstances, where the correlated subquery executed once per candidate embedding row (~4,675 executions for ~350 persons — live prod measurement: 39.3 s per dropdown open; before #1144: 75 ms).Change
Thumbnails now resolve in one batched query after the scoring loop (step 2b):
RANKING_IN_CHUNK_SIZE(1000) scored instance ids — 1 statement for ~350 personspersonRanking's personRows query (~113 ms for the full universe)Display-only: scores, ordering, filters, occurrence counts and row sets unchanged. Expected endpoint latency ~200 ms (from 39.3 s).
Validation
ClassInstanceDiscoveryServiceTest: 326/326Fixes the regression from #1144 (ISSUE-140 in KNOWN_ISSUES.md follows).