In the process of generating SQLite database files on an SD card in Android today, A. db-journal file with the same name as the database file is generated next to the generated. db file, and Google has an official document for SQLite because it does not understand the purpose of the file.
Find the file for the following purposes:
This file is a temporary log file of SQLite, mainly used for sqlite transaction rollback mechanism, generated at the beginning of the transaction, deleted at the end of the transaction, when the program crashes or the system loses power, the file remains on disk so that the next time the program runs, the transaction is rolled back.
But when I created the database and ended the transaction, and the program didn't crash, why would I still have a. db-journal file on disk?
In-depth research, found that this is a different mode of SQLite generated log files caused by the android in this mode, the. db-journal file is permanently left on the disk will not be automatically erased, If a transaction rollback does not occur then the size of the. db-journal file is 0, which avoids the overhead of generating and deleting. db-journal files each time.
To this, all the doubts were untied.
Original link: http://blog.csdn.net/kaiwii/article/details/8609093
[Turn]android sqlite db-journal file Cause and description