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. When the program crashes or the system is powered off, the file will remain on the disk for the next program to 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 files are permanently stored on the disk and will not be automatically cleared. If no transaction rollback occurs, then. DB-Journal

The file size is 0, which avoids the overhead of every generation and deletion of the. DB-Journal File.

At this point, all the doubts have been solved.

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. When the program crashes or the system is powered off, the file will remain on the disk for the next program to 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 files are permanently stored on the disk and will not be automatically cleared. If no transaction rollback occurs, then. DB-Journal

The file size is 0, which avoids the overhead of every generation and deletion of the. DB-Journal File.

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.