Repository navigation
Bound history index scans by the causal trigger timestamp - #222
Merged
Merged
Conversation
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.
Recent dialog history can spend tens of seconds reading newer rows before applying its causal trigger filter. Production inspection observed a 40-second
DataFileReadwait, and the query plan placed the upper timestamp only inFilter, outside the index range.Add the equivalent
occurred_at <= trigger_timestampcondition to both chat and thread tail queries. PostgreSQL can now seek within the causal timestamp range. The existing strict timestamp/message-ID boundary, ordering, topic resets, UTC partition bounds, and result limits are unchanged. No migration or persisted-data change.Validation:
cargo fmt --all;git diff --check; workspace/all-target tests (2456 passed, 10 ignored); workspace/all-target Clippy with-D warnings. Actual Postgres 17 + pgvector checks passed in a disposable database: outbox compatibility and the history round-trip, including UTC offsets, topic/reset exclusions, same-timestamp message IDs, and JSON query-plan assertions that both index scans include the causal upper timestamp. A read-only plan on the production schema also places the upper bound inIndex Cond. Latency improvement still requires the next deployed observation window.