Searching All Subscriptions takes five seconds #459
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A search on All Subscriptions (filter all, sort published) takes 4.5-5 s, the page and its count each scanning every entry's title and description with
lower(...) LIKE '%q%'(entries_where in crates/ipx/src/db.rs, the search clause near line 1279). Seen 2026-11-13 17:29 and 17:30 UTC from the iPhone, trace 52e4d7cff272d32d7913f30a0940e1ca: step entries_in/page 4977 ms, count_in 4962 ms, everything else under 60 ms.Query:
$Q spans '{resource.deployment.environment.name="production" && resource.service.name="ipx" && name="step" && duration > 200ms} | select(span.of)' 7dWays out: a pg_trgm GIN index on lower(title) and lower(description) on Postgres (SQLite keeps the scan), and running the page and the count concurrently, or skipping the count for a search, so the two scans are not paid one after the other. Check with EXPLAIN (ANALYZE, BUFFERS) on production first.
EXPLAIN (ANALYZE, BUFFERS) on production, 2026-11-14, the count as ipx sends it for '%apple%':
pg_trgm is available on the server but not installed. Choices:
Waiting on the owner's choice.
Fixed in
b046e66(trigram on plain text, the owner's choice), deployed. The backfill made 674,269 items' search text in 13 minutes; VACUUM (ANALYZE) entries after it, with the owner's leave, cleared the backfill's dead entries from entries_unsearched. Live through the API: 'kubernetes' 25-95 ms, was about 5 s. A word in about one item in nine ('apple', 75,000 matches) still takes about 1.9 s: the count and the page re-check every match's text (a trigram match is a candidate). Filed apart.