SQLite Forum

memory vs mmap
A ":memory:" database is EXCLUSIVELY owned by a SINGLE CONNECTION.  Of course it is blazingly fast when compared to a "shared" database which may have contention between multiple connections, and which has to perform I/O operations to extremely slow permanent storage.

There is a "continuum" of performance between an exclusive ":memory:" database and a "shared access" database which resides on permanent storage of some sort.

That is to say that a "shared access" ":memory:" database is SLOWER than an "exclusive access" ":memory:" database by the overhead imposed by having to manage the "shared" access.

Similarly, an exclusive access database living on persistent storage is "faster" that a shared access database living on persistent storage.

mmap does not speed up I/O.  It only eliminates double-buffering.

You can always put a database on a RAMDISK or /dev/shm on *nix-like OSes.