statement.stat(counter)
counter<string> 要读取的计数器名称。以下之一:'fullscanStep'SQLite 在完整表扫描过程中进入表的次数。'sort'已经发生的排序操作次数。'autoindex'自动创建的临时索引中插入的行数,这些索引用于加快连接操作的执行速度。'vmStep'由准备好的语句执行的虚拟机操作次数。'reprepare'由于模式更改或绑定参数更改,该语句被自动重新准备的次数。'run'由预处理语句启动的执行周期次数。'filterMiss'布隆过滤器返回结果的次数,这些结果需要像平常一样进行连接步骤处理。'filterHit'因为布隆过滤器返回未找到而跳过连接步骤的次数。'memused'用于存储准备语句的大概堆内存字节数。
- 返回:<number> 所请求计数器的当前数值。
返回 SQLite 为这个预处理语句跟踪的运行时计数器之一。这个方法是 sqlite3_stmt_status() 的一个封装,并不会重置计数器。断言一个语句不会执行全表扫描(statement.stat('fullscanStep') === 0)是一个有用的检查,用来防止性能下降。
🌐 Returns one of the runtime counters that SQLite tracks for this prepared
statement. This method is a wrapper around sqlite3_stmt_status() and does
not reset the counter. Asserting that a statement does not perform a full table
scan (statement.stat('fullscanStep') === 0) is a useful check to guard
against degenerate performance.
'filterMiss' 和 'filterHit' 计数器需要 SQLite 3.38.0 或更高版本。链接到老版本 SQLite 的构建(带有 --shared-sqlite)不会暴露它们,传入任意一个名字都会抛出 ERR_INVALID_ARG_VALUE。
🌐 The 'filterMiss' and 'filterHit' counters require SQLite 3.38.0 or later.
Builds linked against an older SQLite with --shared-sqlite do not expose them,
and passing either name throws ERR_INVALID_ARG_VALUE.