Hacker News new | ask | show | jobs
by emadda 406 days ago
Sometimes using mmap for SQL queries can speed them up (if you want to avoid adding too many indexes or cannot modify the db).

Set this on the connection:

PRAGMA mmap_size=…

https://www.sqlite.org/mmap.html

I think this works as it removes data copying between the os and your process.

Your process reads data from the os to execute the query.

With mmap the data reads have less overhead, so a full table scan may be fast enough.