diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index 850358ff43aa86..7f142602f199b7 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -1202,6 +1202,39 @@ added: v22.5.0 The source SQL text of the prepared statement. This property is a wrapper around [`sqlite3_sql()`][]. +### `statement.stat(counter)` + + + +* `counter` {string} The name of the counter to read. One of: + + * `'fullscanStep'` The number of times SQLite has stepped forward in a table + as part of a full table scan. + * `'sort'` The number of sort operations that have occurred. + * `'autoindex'` The number of rows inserted into transient indices that were + created automatically to help joins run faster. + * `'vmStep'` The number of virtual machine operations executed by the + prepared statement. + * `'reprepare'` The number of times the statement has been automatically + reprepared due to schema changes or changes to bound parameters. + * `'run'` The number of times the statement has run to completion. + * `'filterMiss'` The number of times the Bloom filter returned a result that + required the join step to be processed as normal. + * `'filterHit'` The number of times a join step was bypassed because a Bloom + filter returned not-found. + * `'memused'` The approximate number of bytes of heap memory used to store + the prepared statement. + +* Returns: {number} The current value of the requested counter. + +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. + ## Class: `SQLTagStore`