Menu

1 / 2

Natural language SQL needs query budgets

DEV Community·Mads Hansen·6 months ago
#wviA7rUz
#database#ai#mcp#sql#query
Reading 0:00
15s threshold

Read-only access is necessary for AI database agents.

It is not enough.

A read-only agent can still:

scan too much data

run expensive queries

return more rows than needed

touch sensitive tables

answer from a scope the user did not intend

That is why production natural language SQL needs query budgets.

What is a query budget?

A query budget defines what an AI database workflow is allowed to spend or touch before a query runs.

It can include:

maximum rows returned

maximum runtime

approved tables or views

allowed columns

maximum date range

cost or warehouse limits

rate limits per user/workflow

approval requirements for exceptions

The point is not to make agents less useful.

The point is to make useful access predictable.

Natural language hides query shape

A user asks:

Which customers are at risk this quarter?

That may be a perfectly reasonable business question.

But the generated query might be much broader than the user expected.

So the system needs boundaries outside the model’s…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.