Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.84k stars 1.41k forks source link

为什么初始化时select count(*) from message执行超过100ms #1103

Closed Yellowyzzz closed 5 months ago

Yellowyzzz commented 5 months ago

The language of WCDB

Kotlin

The version of WCDB

v1.0.8.2

The platform of WCDB

Android

The installation of WCDB

e.g. Cocoapods, Carthage, Maven, AAR Package or Git clone

What's the issue?

目前使用room+wcdb 1.0.8.2版本,在SQLiteTrace.onSQLExecuted上报埋点,发现在执行时间>100ms的sql中,select count(*) from message占比超过30% 本地测试的时候打印log也可以看到这条sql执行时间与其他相比是较长的

wcdb_init

顺便问一下为什么2.x版本不支持room了,升级有较大改动成本

Qiuwen-chen commented 5 months ago

You can use "explain query plan" to analyze your query process.

Qiuwen-chen commented 5 months ago

We don't use room, so there are no plans to support it now.

Yellowyzzz commented 4 months ago

@Qiuwen-chen sry我的提问出错了,想问的是“PRAGMA journal_mode”这条sql在初始化的时候耗时异常的高。SQLiteTrace.onSQLExecuted上报点位执行时间>100ms的sql中,PRAGMA journal_mode参与超过30%。本地测试非常少的数据量dump命令看它的耗时也是挺高的

image