Commit f20a05d
fix(taxa): drop redundant taxa filter from occurrences_count aggregate
Including the default taxa include/exclude filter in the conditional-aggregate
filter added a parents_json containment join the planner couldn't reconcile with
the detections (?collection=) join, turning the collection page into a multi-minute
scan. It is redundant: occurrences_count groups by determination = the taxon row,
so the per-occurrence taxa filter just mirrors filter_by_project_default_taxa
(already applied to the queryset). Keep only the per-occurrence score threshold in
the aggregate; the verification base still gets the full filters (sparse, cheap).
Collection-filtered list now ~0.3s (page + COUNT); default/verified/ordering ~0.1-0.4s.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 7f571be commit f20a05d
1 file changed
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1710 | 1710 | | |
1711 | 1711 | | |
1712 | 1712 | | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
1718 | 1713 | | |
1719 | | - | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
1720 | 1722 | | |
1721 | 1723 | | |
1722 | 1724 | | |
1723 | | - | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
1724 | 1730 | | |
1725 | 1731 | | |
1726 | 1732 | | |
| |||
1730 | 1736 | | |
1731 | 1737 | | |
1732 | 1738 | | |
1733 | | - | |
1734 | | - | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
1735 | 1743 | | |
1736 | | - | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
1737 | 1751 | | |
1738 | 1752 | | |
1739 | 1753 | | |
| |||
0 commit comments