The generation and causes of Android SQLite db-journal files

Source: Internet
Author: User
Tags sqlite database sqlite db

The person who pays attention will find that in the process of generating the SQLite database file on the SD card in Android, the next side of the generated. db file is found.

A. db-journal file with the same name as the database file was generated with a size of 0 and did not understand the purpose of the file, so

Google has the official SQLite document, found that the purpose of the file is as follows:

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 a program crashes or the system loses power, the file remains on disk for the next program to run

When a transaction is rolled back.

But when I created the database, I ended the transaction, and the program didn't crash, and why would I still have it on disk?

Where is the. db-journal file?

In-depth study, found that this is the SQLite generated log files caused by different modes, in the Android adoption of this mode,

. db-journal file is permanently left on the disk and will not be automatically purged if a transaction rollback does not occur. Db-journal

the size of the file is 0, which avoids the cost of generating and deleting. db-journal files each time.

To this, all the doubts were untied.

The generation and causes of Android SQLite db-journal files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.