Sqlite WAL 模式:我应该在 WAL 模式下锁定多长时间? [英] Sqlite WAL mode : how much time should I expect to be locked in WAL mode?

查看:32
本文介绍了Sqlite WAL 模式:我应该在 WAL 模式下锁定多长时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划在 WAL 模式下使用 Sqlite(在 Web 服务器上).

I plan to use Sqlite with WAL mode (on a web server).

据我所知,即使写入发生在同一时间,这种模式也不会阻止读取.

As I understand, the reads are never blocked with this mode, even when write occurs in the same time.

一次仍然只有一个写事务,但我猜锁定时间很短,因为只有当 WAL 文件超过一定大小时才会对 db 进行实际写入.

There is still only one write transaction at a time but I guess the lock time is short because the actual write on the db occurs only when the WAL file exceed a certain size.

所以:

  • 当事务写入 WAL 文件时,我应该期望在 WAL 模式下锁定多长时间?WAL文件什么时候提交?

  • How much time should I expect to be locked in WAL mode when the transaction is written on the WAL file ? When the WAL file is commited ?

是否有测试该点的基准?

Is there any benchmarks out there testing that point ?

谢谢.

推荐答案

非常快.我有一个基于 Web 的 API (PHP+SQLite),每月处理 2 到 500 万次(读/写)事务.使用 PRAGMA journal_mode = WAL 没有问题.这只是我所知道的观察数据,但我认为它可能会有所帮助.

It is very quick. I have a web based API (PHP+SQLite) that processes 2 to 5 million (read/write) transactions per month. With PRAGMA journal_mode = WAL there have been no issues. This is only observational data I know, but thought it might be helpful.

这篇关于Sqlite WAL 模式:我应该在 WAL 模式下锁定多长时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆