Skip to content

sqlite: expose prepared statement stats #64540

Description

@bakkot

What is the problem this feature will solve?

Sqlite's prepared statements collect various statistics about their behavior; see the full list here. It would be nice to expose them.

Most notably, as discussed here, you can check whether a statement has performed a full table scan. Asserting that a statement does not perform a full scan is a very useful check to prevent degenerate performance.

What is the feature you are proposing to solve the problem?

Add one or more methods or getters on StatementSync exposing this information.

This could be:

  • a single method where you pass the name of the counter you're interested in and get a number back
  • a single method with no parameters which returns all the counters as an object
  • a method for each counter
  • a getter for each counter

My inclination would be getters, but I'm ok with any of these options.

Optionally, we could also expose methods to reset the counters. That seems less important but it's a feature in the underlying API.

What alternatives have you considered?

I don't think there is any way to do this currently. sqlite3_stmt_status isn't exposed to userland by any mechanism I can find.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions