Mehdi Akiki

Posts tagged "query plans"

  • Published on
    Your tenant has enough documents, but an HNSW query returns too few. Compare real plans, iterative scans, and an exact fallback without weakening access checks.
  • Published on

    Investigation · Part 7 of 10 · Inside a database index

    Planner Statistics Go Stale Too: ANALYZE and a Plan That Changes

    Without statistics, SQLite picked the wrong index and took 97 ms instead of 0.9 ms. ANALYZE fixed it. Then I changed the data, and the old statistics kept a slow plan that PRAGMA optimize did not see. Statistics are derived data too, and they can also live in an open connection.
  • Published on

    Investigation · Part 6 of 10 · Inside a database index

    When the Database Ignores Your Index

    An index exists, and the plan still says SCAN. I tested six cases on SQLite: a function on the column, LIKE, a leading wildcard, OR, a join between a TEXT and an INTEGER column, and a value that matches 93% of the rows. In the last one, ignoring the index is the right choice.