mmap and blobs
(1) By anonymous on 2021-10-08 07:47:38 [link]
Hello, I've read https://www.sqlite.org/intern-v-extern-blob.html when storing blobs in external files they can be mmapped and their address passed around. When using internal blobs it seems at least one allocation and a copy is made when reading the blob, even if sqlite is used in mmap mode. Am I right in concluding that directly mapping internal blobs to memory is not possible? thank you
(2) By Stephan Beal (stephan) on 2021-10-08 08:22:43 in reply to 1 [link]
> Am I right in concluding that directly mapping internal blobs to memory is not possible? Blobs may span multiple db pages and thus not all bytes in them will necessarily reside in contiguous on-storage memory, making them incompatible with direct memory mapping. Consider what would happen if they *were* mmapped and their records were deleted while you were using them (and then those db pages reused for other records). *That Way Lies Madness*.