perf(search): stored tsvector column + saner short-term prefixing for ⌘K search (#597)
* perf(search): store the search tsvector in a generated column The chat-search GIN index was built over an expression that calls a plpgsql JSON parse per row, so every lossy bitmap recheck re-parsed entry payloads — benchmarked at ~96% of query time on a 1M-row corpus (102.6s -> 4.0s for a two-term query). Store the tsvector in a generated column, index that, and query it directly. Also stop prefix-expanding 1-2 character terms: a short prefix expands to a huge GIN key set (14.7s inside the index scan alone for 'de:*'). Short terms now match whole words; the in-memory mirror follows suit. The old expression index is dropped after the replacement index builds. Note: adding the stored generated column rewrites session_entries once at boot. * style: prettier --------- Co-authored-by: Josh France <josh@ycombinator.com>
J
Joshua France committed
62772f544801caa7e69fcb9839e5de5877375e9a
Parent: f390d50
Committed by GitHub <noreply@github.com>
on 8/19/2026, 11:22:38 PM