Skip to content

Add queryTimeoutMs config option#2

Merged
deepa0128 merged 1 commit into
mainfrom
feat/query-timeouts
Apr 23, 2026
Merged

Add queryTimeoutMs config option#2
deepa0128 merged 1 commit into
mainfrom
feat/query-timeouts

Conversation

@deepa0128

Copy link
Copy Markdown
Owner

What

Exposes a queryTimeoutMs option on both PostgresConfig and MysqlConfig.

Postgres — passes the value as statement_timeout to pg.Pool, which sets a PostgreSQL session-level statement_timeout. The database cancels any statement that exceeds the limit server-side.

MySQL — passes { sql, values, timeout } to mysql2's execute, which triggers a server-side KILL QUERY after the specified milliseconds. This uses mysql2's built-in mechanism, not a client-side race.

Usage

const db = createClient({
  dialect: 'postgres',
  // ...
  queryTimeoutMs: 5000, // cancel queries after 5 s
});

Stacks on #1.

Base automatically changed from feat/typed-errors to main April 23, 2026 09:37
@deepa0128
deepa0128 merged commit 90374cf into main Apr 23, 2026
@deepa0128
deepa0128 deleted the feat/query-timeouts branch April 23, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant