fix(state): narrow FTS UPDATE triggers to payload-bearing columns - #73113
Closed
smfworks wants to merge 1 commit into
Closed
fix(state): narrow FTS UPDATE triggers to payload-bearing columns#73113smfworks wants to merge 1 commit into
smfworks wants to merge 1 commit into
Conversation
Narrow the messages_fts_update and messages_fts_trigram_update triggers to only fire when content, tool_name, or tool_calls actually change, instead of on every UPDATE (including status-only writes like the active flag). On a ~447k-message DB this eliminates multi-GB of redundant FTS churn per SessionDB open. Migration contract (per review of the FTS trigger narrowing PR): - Inspect sqlite_master.sql; only migrate when an existing UPDATE trigger is broad (no WHEN clause). - Drop only the two UPDATE triggers, recreate with individual cursor.execute() calls (not executescript). - Keep INSERT/DELETE triggers present throughout. - Do NOT rebuild FTS: broad triggers may have over-indexed unchanged payload, but have not missed content updates. - Idempotent: reopening an already-converged DB performs reads only. Fixes NousResearch#68891
Contributor
Author
|
Superseded by #73639 — same 13 FTS commits cherry-picked onto current upstream/main with zero conflicts. This PR was conflicting due to fork divergence between smfworks:main and upstream. |
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.
Narrow the messages_fts_update and messages_fts_trigram_update triggers to only fire when content, tool_name, or tool_calls actually change, instead of on every UPDATE (including status-only writes like the active flag). On a ~447k-message DB this eliminates multi-GB of redundant FTS churn per SessionDB open.
Migration contract (per review of the FTS trigger narrowing PR):
Fixes #68891