惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CERT Recently Published Vulnerability Notes
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
Schneier on Security
Schneier on Security
T
Threatpost
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
T
Threat Research - Cisco Blogs
罗磊的独立博客
Security Latest
Security Latest
D
Docker
S
Secure Thoughts
博客园 - 聂微东
A
Arctic Wolf
Recorded Future
Recorded Future
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
P
Palo Alto Networks Blog
Project Zero
Project Zero
Blog — PlanetScale
Blog — PlanetScale
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
T
The Blog of Author Tim Ferriss
Latest news
Latest news
AWS News Blog
AWS News Blog
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
F
Full Disclosure
Martin Fowler
Martin Fowler
T
The Exploit Database - CXSecurity.com
Attack and Defense Labs
Attack and Defense Labs
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
小众软件
小众软件
宝玉的分享
宝玉的分享

SQLite

SQLite 开启 WAL 后,我的同步服务吞吐量提升了 3 倍 在什么情况下一定要放弃 SQLite 采用 MySQL 呢? - V2EX SQLite 背后的故事 - V2EX 应该怎么理解 rowid 在 sqlite 中的使用 - V2EX macOS 上有什么好用的 SQLite GUI ? - V2EX SQLite In-Memory 作为数据缓存代替 Java Object - V2EX 什么时候调用 sqlite.close()呢 - V2EX 回复“什么场景下用 SQLite”的主题并分享一个年收入 60 万刀的技术栈 - V2EX 大家有用 Sqlite 的吗,都是什么场景下要用这个,能说一两点非要用它的理由最好啦 SQLite Viewer Web App - V2EX 本地数据库 除了 SQLite 还有什么好用的. - V2EX 请教一个方案,边缘设备的 sqlite 数据如何才能获取到 - V2EX 有人知道怎么在 termux 上编译 sqlcipher 吗? 求一个数据库设计问题! - V2EX SQLite 被曝漏洞,影响范围很大 - V2EX 两个读写 SQLite 数据库的浏览器扩展 - V2EX How SQLite is tested 如果需要寫入數據, 不僅數據文件要有寫入權限, 數據文件所在的目錄也要有寫入權限 - V2EX 用sqlite3作为论坛的数据库行不行? About Sqlite 之前的一篇笔记 - V2EX 如何把一个2G的sqlite数据库分割成小的? - V2EX Base 2.0 - V2EX
分享适合高并发场景的 SQLite 设置 - V2EX
cj323 · 2025-08-19 · via SQLite

这是一个创建于 300 天前的主题,其中的信息可能已经有所发展或是发生改变。

最近写了个对 sqlite 数据库读写都比较大且频繁的程序,踩了一些坑。最后用了如下配置最大化 sqlite3 的性能。

PRAGMA journal_mode = WAL;
PRAGMA busy_timeout = 5000;
PRAGMA synchronous = NORMAL;
  1. journal_mode = WAL: 支持读写同时进行。高并发下提升最明显
  2. busy_timeout:可以缓解同时多写入时的 SQLITE_BUSY 报错。5000 是五秒。
  3. PRAGMA synchronous = NORMAL; 减小默认同步频率

内存够用的话还可以设置这两个选项加大内存缓存。

PRAGMA cache_size = 1000000000;
PRAGMA temp_store = memory;
JFZ

1

JFZ      2025 年 8 月 19 日

WAL 会多个文件出来。

heimoshuiyu

2

heimoshuiyu      2025 年 8 月 19 日

SQLite 怎么会有并发呢,写入都是单线程上锁的,自己写个单线程的 worker 顺序处理写操作可能比一堆线程在那竞争锁还快

felixcode

3

felixcode      2025 年 8 月 19 日 via Android

使用场景有问题

strobber16

4

strobber16      2025 年 8 月 19 日 via Android

当年我引入 sqlite 的时候问的 gpt ,gpt 就是给的一模一样的这三条