Skip to content

Search index keeps the old entries of every re-indexed message #149

Closed

Description

@neoromantic

After the one-off message_search_names re-index (0.11.0, #93), the search index of a real account cache (1.16M messages) still holds the old entry of every message next to the new one: deletemerge=0 keeps deleted rows until a merge, and no merge comes. Measured on a copy of that cache:

now after FTS5 optimize
index data (message_search_data) 263 MB, 20 segments 125 MB, 1 segment
asking the index whether one message matches 2.2–4.6 ms 5–7 µs
newest page of a word in 19% of messages (sorted) 205 ms 173 ms

optimize took 3.2 s at 1.16M messages, in one write transaction.

Effects:

Proposal: merge the index in small steps in the background (daemon and tg db migrate, like the background migrations), after a re-index and whenever deleted rows pile up; this also covers the merge spikes of #142. Then retune the walk of #118 for a merged index, or bound it by measured time instead of a fixed threshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions