# NousResearch/hermes-agent · FTS trash table deletion O(n²) performance fix

## Open now

- Nothing open on GitHub.

A performance issue was identified where FTS trash table cleanup used a DELETE...IN(SELECT...LIMIT N) pattern that scaled quadratically on large tables. A proposed fix replaces the re-scanning approach with a high-water marker strategy.

## TL;DR

- 3 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #81043. Verify it addresses your case.
- **Recommended:** read PR #81043 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-81043`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.67`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #79324: \[Perf\]: _fts_teardown_trash_step DELETE ... IN (SELECT ... LIMIT N) is O(n²) on large trash tables

## Prior & competing PRs

- **#81043: perf(fts): drain trash tables with a high-water marker instead of re-scanning**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `hermes_state_search.py`, `tests/test_hermes_state.py`
- **#79359: perf(fts): drain trash tables with a high-water marker instead of re-scanning**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#81043`

## Fix status

- Merged to main in PR #81043 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-07`.
