Limits & risk model
Row limits, the sample ceiling, the query timeout, read-only sessions, risk scoring, and when confirmation is required.
Row limits and a 10 MiB encoded sample ceiling cap what a query returns. Plan-based scoring estimates cost before the query runs.
Limits
- Default sample
- 500 rows.
- Row limit
- The builder offers 500, 1,000, 5,000, ALL, or a custom positive value. Typed SQL keeps any positive LIMIT up to the 32-bit integer maximum; omitting it means ALL.
- Sample ceiling
- The client stops reading at 10 MiB encoded and marks the sample truncated. The query timeout still applies.
- Query timeout
- 1 to 120 seconds, default 10. Applies to the next query run and its plan check. Connect and schema introspection stay fixed.
- Advisory nudge
- Shown when a request exceeds 1,000 rows. Add filters or pick columns to keep queries fast.
- IN (...) values
- More than 1,000 values in one predicate is a validation error, not a silent trim.
- Connect timeout
- 10 seconds to open the connection. Separate from the query timeout.
- Connection errors
- Authentication failure or an unreachable host returns a short message naming the user or host, not a driver stack.
- Filter nesting
- 5 levels. Deeper groups are a validation error.
- Text literal
- 10,000 characters in one filter value.
The limits above apply at every risk-gate setting.
Read-only sessions
The pool is one connection, and JDBC read-only is on for every engine. The session SQL then depends on the dialect:
- PostgreSQL and MySQL:
SET TRANSACTION READ ONLY, ISOLATION LEVEL READ UNCOMMITTED. - SQL Server:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED, thenSET LOCK_TIMEOUTto the query timeout. - Oracle:
SET TRANSACTION READ ONLY. - Db2: no session SQL. The connection is auto-commit off, read-only, and
isolation
TRANSACTION_READ_UNCOMMITTED, so a fetch does not block an updater of a row it is reading.
Risk scoring
A run is scored from the query and schema first. Then safe-db asks the database for a plan, and the score may refine. Severity is reported on a fixed scale: Minimal concern, Elevated concern, High concern, Very high concern. The status line reports the severity and whether Run is enabled. Reported reasons are the scoring evidence, including on allowed runs. Duplicate join and self-join scan reasons collapse to one signal.
Set the gate in Settings:
- Cautious blocks Elevated concern and above.
- Standard (the default) blocks High concern and above.
- Flexible’s severity band is Very high concern.
Severity alone decides whether the gate blocks. A plan-confirmed large scan is not an extra hard block beyond the band.
Plan estimates account for a row limit where the database can stop early. A LIMIT 1 scan of a large table can score Low, while sorts, hash or merge joins, and aggregates still count
their full input because a limit does not bound that work. A large estimated row set on either side
of a join also raises the score.
Off turns off that descriptive scoring and skips EXPLAIN. A
plan-check failure cannot block a run or ask for confirmation while the gate is off. The row
limit, sample ceiling, and timeout are not controlled by the risk gate.
When confirmation is required
A missing plan or a missing optimizer cost asks for confirmation only when the risk gate would otherwise allow the run. If the score already blocks the gate, the run is blocked and confirmation is not offered. A high but valid cost does not ask; that is a scoring input. If risk assessment is still pending, the run is blocked.
A plan check that times out or loses its connection reports an error instead of asking for confirmation. Failure to parse a MySQL JSON plan, including Impossible WHERE, is not confirmation: the query runs under static risk. Off skips the plan entirely, so it cannot produce either prompt.
The Run button is labeled Run. Confirmation is a separate dialog labeled Run with safeguards. The limits above still apply after you confirm. Confirmation allows the query to run. It does not raise the row limit, sample ceiling, or timeout.