perf: 启用 WAL 模式并添加 B-Tree 索引以加速查询#1253
Open
Moeblack wants to merge 1 commit into
Open
Conversation
- 启用 WAL journal 模式,实现读写并发(搜索时不阻塞剪贴板写入) - 添加 B-Tree 索引:createTime、group+createTime、favorite+createTime - 配合分页查询(ORDER BY createTime DESC LIMIT),索引可显著减少扫描行数 相关 issues:EcoPasteHub#467
ef55cbc to
7566ce7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为大数据量用户优化查询性能。
改动
PRAGMA journal_mode = WAL,读写并发,搜索时不阻塞剪贴板写入idx_history_createTime:加速ORDER BY createTime DESC LIMIT分页查询idx_history_group_createTime:加速按分组筛选 + 排序idx_history_favorite_createTime:加速收藏筛选 + 排序配合现有的分页查询(
LIMIT 20),索引可以让 SQLite 沿索引顺序扫描并提前终止,减少不必要的全表扫描。无副作用
IF NOT EXISTS,对已有数据库安全相关 issues:#467