A search for a very common word still takes about two seconds #472
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?
After #459, a search answers in 25-95 ms for most words, but one in about one item in nine ('apple': 75,000 matches across the catalogue) takes about 1.9 s through /api/entries: the count (2.1 s cold) and the page of 50 (1.1 s) each re-check the text of every candidate the trigram index gives (EXPLAIN on production, 2026-11-17). Ways out: count a search's matches only up to a cap (1,000, shown as 1,000+), and for the page walk entries newest first through an index and stop at 50 matches, which a common word reaches quickly.
Fixed in
2ebe77b, deployed: on Postgres a search gives the planner this person's feeds as an array (= ANY(ARRAY(...))) instead of a subquery, so it no longer matches the word in every feed on the server first. Live through the API, warm: 'apple' 0.12 s (was 1.9 s, 0.48 s cold), 'the' 0.08 s, 'kubernetes' 0.03 s. The count stays exact; no cap was needed.