Grdb using SQLite's Wal mode

Source: Internet
Author: User
Tags sqlite
Grdb using SQLite's Wal-mode Wal full name is the write Ahead Logging, which is a mechanism for implementing atomic transactions in SQLite. This mode was introduced from the SQLite 3.7.0 release. Before that, SQLite uses the rollback journal mechanism to implement atomic transactions. In the rollback journal mechanism, when the data needs to be modified, the modified data is first backed up, and then the data of the database is modified. If the transaction succeeds, the backup data is deleted, and if the transaction fails, the backup data is restored. The disadvantage of this mechanism is that it is frequently read and written and cannot be read. The Wal mode works like its name, writing a log file before writing to the database. This log file is named Wal file. When the transaction succeeds, the modified content remains in the file. When the transaction fails, it is removed from this file. When the record of the Wal file accumulates to a certain number, it is written to the database once. If the database is read, it is read from the Wal before the database file is read. In this way, the write operation does not affect the read operation, thereby increasing efficiency. Grdb directly supports the WAL mode. When a developer uses Databasepool to establish a database connection, the default is to use the Wal mode, which is not used if a connection is established using Databasequeue. If there are too many accumulated data in the Wal, writing to the database can result in degraded database performance, so avoid Wal accumulating too much data.

Grdb using SQLite's Wal mode

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.