SQLite3 simple index tests and a bit worrying results

I did some SQLite3 indexing tests and got quite interesting yet not actually very surprising results.

Test setup two int columns and one first with low cardinality and second with high cardinality.

10 million ~1 KB rows.

Test timing:

1. Without index 1045 seconds

2. With column 1 index 50 seconds

3. With column 2 index: 0.12 seconds

4. With column 1 and 2 indexed : 46 seconds

5. With column 1 and 2 composite index: 0.17 seconds

I did run several test queries with higher and lower number of queries being done, but that actually didn't change a thing, time required relative to other tests. So times do not matter, only rations between those queries.

Only thing which actually baffles me is that why 1 and 2 indexed gives so poor result (test 4). It means just one thing, index selection failed very badly.