Is it possible to put the journal file to non-volatile RAM
(1) By anonymous on 2021-08-17 07:43:35 [link] [source]
I have a hardware that supports a limited size of non-volatile RAM. So, I'd like to utilize it in Sqlite database. I found that the journal_mode can be set to MEMORY which means the journal file will be stored to the memory. Can I specify this memory address and size ? For example, the NVRAM address is mapped to the memory address 0x10000 and its size is 512KB. So, can I set the journal file to store at the address 0x10000 and the jouranl size limit be set to 512*1024 bytes ?
(2) By Simon Slavin (slavin) on 2021-08-17 12:12:26 in reply to 1 [link] [source]
You can't do that, but there's probably a way to get the overall result you want.
What is the point in setting SQLite to store a journal file in memory, but then moving that memory to non-volatile memory ? Doesn't that have the same result as just leaving the journal file in the same folder as the database, which is the default ?
What result as you searching for ? And what kind of hardware are you using ? A normal desktop computer, a smartphone, or an embedded processor ?
(3) By anonymous on 2021-08-17 14:35:16 in reply to 2 [source]
What is the point in setting SQLite to store a journal file in memory, but then moving that memory to non-volatile memory ?
The purpose is to keep the behavior of memory journal mode to be the same as persist or delete mode.
Doesn't that have the same result as just leaving the journal file in the same folder as the database, which is the default ?
They are a bit difference in performance. Since I'm using an embedded system, the memory journal file mode will be faster than any other mode. In embedded system, it usually perform a power cycle to reboot the hardware. In this case, I want the sqlite db file not being corrupted after a power cycle. However, the sqlite doc says that if using memory journal mode, it will a little risk for the db file safety and integrity.
So, my idea is to use a NVRAM to store the memory journal file. This will provide both performance and db file safety. Is it possible ?