A search on All Subscriptions took 4.5-5 s: the page and its count each
matched lower(title) and lower(description) with LIKE '%q%' over every
entry, a parallel seq scan reading 554k buffers, about 4.3 GB, nearly all
of it descriptions' HTML in TOAST (EXPLAIN on production, 2026-11-14).
entries.search_text holds the title and the text with its markup taken
out (an image's alt and title kept, as Signals read them), lowercased
and cut at 4,000 characters; a pg_trgm GIN index on it keeps a part of a
word finding the word (#296's meaning). Chosen over a trigram index on
the HTML itself, several GB on the shared Postgres, and over full-text
search, which matches whole words only.
A new item gets its search text as it is stored. search.rs fills in the
rest behind the daemon, 500 at a time, and makes the index after,
CONCURRENTLY so scans go on, again if a build was cut off. A scan that
changes an item's title or text clears its search text for that pass to
make again; until then, and for every item stored before this, a search
matches it the old way, through a partial index on the ones without.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>