sqlite> .schema actor
CREATE TABLE actor (
id INTEGER PRIMARY KEY, name TEXT, gender TEXT
);
sqlite> explain query plan
...> select * from actor where id = '305453';
0|0|0|SEARCH TABLE actor USING INTEGER PRIMARY KEY (rowid=?)
sqlite> explain query plan
...> select * from actor where name = 'Connery, Sean';
0|0|0|SCAN TABLE actor
sqlite>
SEARCH TABLE actor USING INTEGER PRIMARY KEY (rowid=?)
is taking significantly less time compared to SCAN TABLE actor
It is obvious that SCAN TABLE actor
is an exhaustive scan of actor
table due to chance of duplication, but,
1) Are SCAN TABLE
& SEARCH TABLE
scanning B-TREE or sequence of records?
2) If it is B-Tree, then how SEARCH TABLE
query faster?