Mehdi Akiki

Posts tagged "query plans"

  • 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.
  • Published on

    Investigation · Part 2 of 10 · Inside a database index

    Reading EXPLAIN QUERY PLAN: SCAN Versus SEARCH

    SQLite says SCAN or SEARCH before it runs a query. I measured what the two words mean on one million rows: 16,469 pages against 7, and about 34 ms against 6 microseconds when the file is cached. With a cold cache the gap is much smaller.