feat(taxon-tiles): improve performance and scope to collection - #8584
Open
grantfitzsimmons wants to merge 6 commits into
Open
grantfitzsimmons wants to merge 6 commits into
grantfitzsimmons wants to merge 6 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
grantfitzsimmons
marked this pull request as ready for review
September 26, 2026 15:37
Member
Author
|
@coderabbitai review |
Contributor
|
Member
Author
|
@coderabbitai review |
Contributor
✅ Action performedReview finished.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #303
Warning
This PR affects database migrations. See migration testing instructions.
This PR makes
taxon_barcollection-scoped and improves the performance of current-determination counts.For some reason, taxon rows were filtered by collection discipline, but determination counts were not restricted to the active collection. The count query also lacked an index matching its collection-scoped predicates (so it took sooo long to complete). In the future, we should consider using Materialized Views in PostgreSQL once we migrate since this should be cached for general cases (like statistics visualizations in most contexts).
performance_tiles.mp4
Changes
collectionmemberidmatches the active collection.DetColMemCurrentTaxonIDXon(collectionmemberid, iscurrent, taxon).User-visible changes
Performance
On the KU entomology database with 1,786,726 determinations and 42,520 taxa:
taxon_barwith the index: approximately 0.29–0.39 seconds.taxon_barwithout the index: approximately 4.10–4.22 seconds.Checklist
Testing
mainandissue-303(noting that this PR introduces a migration)Summary by CodeRabbit