ReinDBby Bandlei

14. How ReinDB fits in

Brett Rosenblatt · Database tuning guide v1.3 · PDF

ReinDB is Bandlei's read-only drift monitoring for PostgreSQL, MySQL, SQL Server and Oracle, self-managed or on Amazon RDS and Aurora. It learns what normal looks like for every database, flags what drifts from it, answers plain-English questions with charts, and writes the fix as a script your DBA can test. It never changes your database.

It was built by database practitioners to do the repetitive parts of this guide every hour, for every database, without anyone having to remember.

The Now page: open flags, load against what is usual for the hour, the most drifted statement, the longest lock wait and storage used, with Live now below. Demo database, synthetic data.
The Now page: open flags, load against what is usual for the hour, the most drifted statement, the longest lock wait and storage used, with Live now below. Demo database, synthetic data.

14.1ReinDB at each step of this guide

Guide chapterWhat ReinDB does for you
1. How to startThe Now page and the health check report cover most of the first-hour checklist: flags, load against usual, the worst statement, lock waits, storage, version and patch level, settings
2. ToolkitOne read-only login per database with the smallest grants, from a script per engine. Reads each engine's own statement statistics, needs no host access on managed services, and on Oracle needs no Diagnostics or Tuning Pack
3. Data profileDatabase size every run and table sizes daily, with growth and days-until-full projections; busiest tables; Top SQL
4. Platform choicesTable activity, size history and storage projections: the evidence for keeping, partitioning or tiering a table
5. What to look forDrift flags ranked by the extra database time each costs; time split into CPU, I/O wait and lock wait per statement; wait profile over time; Live now for current sessions, blocking, waits and replica lag
6. Tuning procedureStatement pages with plan history and analysis (disk reads, temp spills, rows examined per row returned, full scans, N+1 patterns, misestimates on Oracle); fix scripts with an undo for each step; Pre-check before deploying
7 and 8. Joins, predicates and indexesIndex suggestions from plans; unused-index findings where the engine records usage; Pre-check flags risky query and DDL changes
9. Procedure codeThe Stored code report on all four engines: row-by-row loops, queries per row, concatenated SQL and other patterns, with the statements inside each routine and a set-based rewrite sketch
11. SettingsSettings review judged against Live, Average or Peak, with a commented fix script, parameter-group instructions on managed services, and scoped session-level settings for the statements that need them
12. BaseliningAn automatic 14-day, hour-of-day baseline for every database and statement; one-click comparisons; saved baselines such as "Before release 4.2"; the "Vs baseline" report
13. ObservabilityThe Fleet page; phone alerts; exit code and command hook for mail, tickets or pages; scheduled exports for Grafana (CSV, JSON Lines or Prometheus textfile); REST API and read-only MCP tools

14.2A quick tour

  • Fleet: every database on one page, worst first. Down and degraded databases are listed at the top with the reason; each tile shows engine, version, uptime, load against usual and the newest measurement. Pro and Enterprise add groups (production, staging, a customer) and side-by-side comparison of one engine's databases.
  • Ask: type a question such as "show drift for the last week as a graph" or "which queries use orders this week?" and get a chart or table with a caption computed from the measurements. A model only interprets the question and picks what to show; it never invents the numbers. Built-in rules work with no model at all, and you can bring your own OpenAI-compatible model.
  • Now: current activity against what is usual for this hour, Live now, long-running sessions, blocking and deadlocks.
  • Drift: what got slower. Flags, statement drift, the watch list, stored code and the busiest tables.
  • Top SQL: the biggest consumers over any range, with when each statement first and last appeared.
  • Baselines: one-click comparisons and saved, named baselines.
  • Environment: waits, CPU, I/O, storage and growth, replication, and the database review with settings.
  • Space: where the space goes and how fast it grows (Oracle and PostgreSQL).
  • Reports: workload, top SQL, waits, I/O, blocking, capacity, stored code and "Vs baseline" reports over any range, printable as PDF, plus reports of your own.
  • Pre-check: paste a query, procedure or DDL change before it ships. ReinDB asks the database for the plan only (nothing is executed) and returns Pass, Review or Risky, with the production statement it would replace, its calls per hour, a suggested rewrite or index, and the quietest hour to deploy.
The Drift page: each flag from when it was first raised until it resolves, with severity, what drifted, the usual range for that hour and the extra time it costs. Demo database, synthetic data.
The Drift page: each flag from when it was first raised until it resolves, with severity, what drifted, the usual range for that hour and the extra time it costs. Demo database, synthetic data.

14.3Getting started

  1. Choose where ReinDB runs. Hosted by Bandlei; onsite on Linux or Windows; or in your own AWS or Google Cloud account. Onsite and in-cloud editions run as one container or Python service, and nothing is installed in the database. For networks where ReinDB may not connect to the database at all, a small local collector can measure the database and send the results instead.
  2. Prepare each database. Run the grant script for its engine to create the read-only login, and make sure the engine's statement statistics source is on (see the engine note below). Optionally, allow Analyze to read plans (an extra grant described in the user guide) so it can suggest indexes from them. For the hosted service, allow ReinDB's address through your firewall or security group.
  3. Add the database in the web app, choose the encryption setting, and test the connection.
  4. Let the baseline form. The first measurement interval needs two runs, so allow an hour or two. Database-wide flags start after five hourly runs, statement flags after a statement has appeared in three runs, and the baseline is complete after 14 days.
  5. Set up alerts. Install the app on your phone from the browser for notifications of new regressions, and set quiet hours. Self-hosted, wire the command hook to your mail, ticketing or paging tool.
  6. Connect your observability stack (Pro and Enterprise): create a scheduled export for Grafana, as described in Chapter 13.
  7. Adopt the routine below.

14.4A week with ReinDB

WhenWhat to do in ReinDB
Every morningGlance at Fleet and Now, or read the daily email. Open any new HIGH flag, click the statement, read where its time goes and its plan history
Before a releasePre-check the changed queries, procedures and DDL; save a baseline named for the release
After a releaseCompare the release baseline with the same hours since; check the watch list
WeeklyRun the "Vs baseline" report for this week against last; review Top SQL and storage growth
MonthlyReview settings against Peak; check the Fleet page for databases behind on patches; read the Stored code report for the busiest routines
During an incidentLive now for sessions, blockers and waits; Ask for "what changed since yesterday?"; download the fix script and test it

14.5Built for strict security boundaries

  • Read-only sessions with each engine's smallest grant. ReinDB never runs a fix; it writes scripts for your change control.
  • No passwords in files: the operating system keyring or a per-database environment variable onsite, and encrypted credentials in the hosted service.
  • Literals are redacted from statement text before anything reaches a model, and you can choose any approved OpenAI-compatible model, or none.
  • Every question and tool call is written to an audit log.
  • TLS with certificate verification to every database.
  • Payment cards are handled by Stripe only.

14.6Plans

The first database is free, with no time limit. Paid plans (Starter, Pro and Enterprise) add more databases and people and phone alerts; Pro and Enterprise add fleet groups and comparison, scheduled exports for Grafana and Excel import. See reindb.com for current plans and pricing.

This is one chapter of the free database tuning guide for PostgreSQL, MySQL, SQL Server and Oracle. Download the whole guide as a PDF.