SQLite Forum

sqlite write performance is slower than the filesystem
Login
Of course if you remove all the overhead of parsing the SQL, parsing the parameters, allocating cells to store the records, and storing the records, then a simple sequential file is faster.

Now, compare the speed of retrieving the n'th record of data.

The SQLite3 database can do that in a few MICROSECONDS while it will take you (on average), 50 milliseconds to do that since you will have to read and discard n-1 records before you get to the record you want.  The SQLite3 database will just return the single record that you wanted directly.

So your "sequential file" is 50,000 times slower than SQLite3 at retrieving data.

Assuming that you are merely writing all your records once, you only need to retrieve more than 3 random records, on average, before the "speed" of using an SQLite3 database is "faster" that your sequential file.

So yes, a sequential file accessed entirely sequentially is superior to a database accessed entirely sequentially.  And how is this surprising?