I suspect there must be more going on than is present in your description. If I run this query on a instrumented build of SQLite that logs all reads/writes and point it at a 16709362688 byte SQLite database, the process reads only 4712 bytes from the file. Indeed it finished very quickly, suggesting not all of the 16gb file was read.