npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dbopt-core

v0.4.4

Published

Find and fix slow SQL before it reaches production. A local-first database performance analyzer compiled from Rust to WebAssembly — runs in Node and the browser and sends nothing anywhere. SQL Server rules today; engine-agnostic by design.

Readme

A database performance analyzer that reads your queries and execution plans and tells you what will hurt — and how to fix it, with the reasoning cited. It is the dbopt engine, written in Rust and compiled to WebAssembly.

No connection. No server. No network call. Your SQL is analyzed in-process, which means you can lint a query you would never paste into a web tool.

npm i dbopt-core
import { analyze } from "dbopt-core";

const { findings } = analyze(
  "SELECT * FROM Orders o WHERE YEAR(o.OrderDate) = 2025",
  { server_version: 2025 },
);

for (const f of findings) {
  console.log(`${f.severity}  ${f.rule}  line ${f.location?.line}`);
  console.log(f.message);
  console.log(f.recommendation);
}
error  sarg.function_on_column  line 1
Calling YEAR() on a column inside a predicate is non-SARGable — the optimizer
cannot seek the index and must scan.
Rewrite the predicate to leave the column alone…

Every finding carries a severity, a source location, the engine-level reason, and a copy-paste fix.

In the browser

The browser build fetches the WebAssembly module on first use, so analyze() is async there. Everything else is identical.

import { analyze, ready } from "dbopt-core/web";

await ready();                     // optional: preload so the first call is instant
const report = await analyze(sql, { server_version: 2022 });

Bundlers (Vite, webpack, Rollup, esbuild) resolve the right build automatically from the exports map; Node gets a synchronous CommonJS build, browsers get ESM.

What it analyzes

| Input | Gives you | |---|---| | sql | 103 rules across sargability, index design, plan shape, hygiene, modern rewrites, locking, tempdb, transactions, security and datatypes | | plan_xml | execution-plan breakdown — operator cost, scans vs seeks, spill and lookup risk | | dmv_bundle | index-usage and sizing analysis with ranked CREATE/DROP INDEX scripts | | server_version | version gating, so a 2022+ rewrite is never suggested for a 2019 target | | engine | which database to analyze for |

Version gating is real, not cosmetic:

const sql = "SELECT CASE WHEN a > b THEN a ELSE b END AS m FROM dbo.T";
analyze(sql, { server_version: 2019 }).findings; // []
analyze(sql, { server_version: 2025 }).findings; // modern.greatest_least_replaces_case_when

Which databases

SQL Server (2014 → 2025) is the engine with rules today, and 100% of the 103 rules are written for it. The core is engine-agnostic by construction: every rule declares which databases it applies to, and engine selects the target. PostgreSQL and MySQL are next. Until their rules land, asking for them returns an empty report rather than guesses — the analyzer would rather say nothing than say something wrong.

Quality

312 tagged scenarios, precision = recall = F1 = 1.000. The corpus is hand-authored, so that proves no regression on the cases we wrote, not a measured real-world false-positive rate. Every one of the 104 rule ids has a scenario, plus 13 more for the 12 plan-XML and DMV checks.

The rest of dbopt

This package is the analyzer. The full tool adds live metric analysis, an index advisor, execution-plan fetching, continuous monitoring and a local web UI — one binary, still local-first.

License

Apache-2.0