Skip to content

Album: Index title

This will avoid a full table scan for each new track we analyze.

Without the index

------------------------------------------------------------
Benchmark                  Time             CPU   Iterations
------------------------------------------------------------
SearchAlbumByName      91721 ns        91720 ns         7677
sqlite> EXPLAIN QUERY PLAN SELECT * FROM Album WHERE title = 'Album_5';
QUERY PLAN
`--SCAN Album

With the index

------------------------------------------------------------
Benchmark                  Time             CPU   Iterations
------------------------------------------------------------
SearchAlbumByName      75062 ns        75061 ns         9330
sqlite> EXPLAIN QUERY PLAN SELECT * FROM Album WHERE title = 'Album_5';
QUERY PLAN
`--SEARCH Album USING INDEX album_title_idx (title=?)

The benchmark was performed on a test database of 50 artists with 10 albums of 10 tracks each

Merge request reports