Android SQLite DB-Journal File causes and descriptions

Source: Internet
Author: User
Tags sqlite db

During the process of generating SQLite database files on the SD card in Android today, we found that

A. DB-Journal file with the same name as the database file with a size of 0 is generated. I do not understand the purpose of this file, so

Google's SQLite official documentation found that the file is used as follows:

This file is a temporary log file of SQLite. It is mainly used for the SQLite transaction rollback mechanism and is generated at the beginning of the transaction,

Delete at the end of the transaction;WhenProgramThe file will remain on the disk in case of a crash or system power failure, so that the next program will run

Transaction rollback.

However, when I create a database, the transaction ends and the program does not crash. Why is it still generated on the disk?

What about the. DB-Journal File?

In-depth research found that this is caused by different log file generation modes of SQLite. In Android,

. DB-Journal FileIt is permanently left on the disk and will not be automatically cleared. If no transaction rollback occurs, then. DB-Journal

The file size is 0, which avoidsOverhead of generating and deleting a. DB-Journal File each time.

At this point, all the doubts have been solved.

Related Article

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.