Auto routing
Auto routing runs each query on-demand or on your reservation, whichever is expected to cost less. It learns from your past runs and shows the route it picked and why.
A query on BigQuery is billed one of two ways: on-demand, by the bytes it scans, or on a reservation, by the slot time it uses. A query that scans a lot but finishes quickly is often cheaper on slots. A small query that runs for a long time is often cheaper on-demand. With Auto, Querylab.io makes that choice for each query.
Turning it on
| Where | How |
|---|---|
| One query tab | Status bar ⚙ → Routing → Auto |
| New query tabs | Settings → Reservations → Default routing → Auto |
| A notebook | The notebook’s settings → Routing. Each cell can use Use notebook setting or its own route. |
The other choices are Use from project (the default: the project’s own route), On-demand, and any reservation you can see. Auto moves queries between the project’s route and the reservation set as Default Reservation in Settings → Reservations. Without one, Auto has no reservation to move queries to.
How Auto decides
After the dry run, Auto estimates what the query would cost on each route. It uses, in this order:
- Earlier runs of the same query.
- Similar queries you ran.
- A guess from how the query is built, from a model trained on real BigQuery jobs.
The first time Auto routes in a project and location, it reads your own jobs from the last 30 days, so it doesn’t start from zero. That read is billed at most 1 GiB, and it happens at most once a week. What Auto learns stays in your browser.
Slot prices follow how BigQuery bills an autoscaling reservation: slots in steps of 50 with a one-minute minimum. A query right after one of your own jobs can use the capacity that job still holds. When fluid scaling is on for the reservation, short queries are priced without the one-minute minimum.
Auto moves a query off the project’s route only when it expects to save at least 20% and at least $0.01, it is at least 80% sure the other route is cheaper, and it has enough evidence. Otherwise the query runs on the project’s route.
Where you see the route
The status bar shows Auto: slots, Auto: on-demand or Auto: project default next to the price. Hover it for the reasons, such as Expected to save about $0.31 (74%) on this run. and how likely the other route is to cost more. In a notebook, each cell’s bar shows its route.
After the run, the Info tab of the result has a Routing row with the route and the reasons, and an Other route row with what the other route would have cost.
When Auto keeps the project’s route
- The query is a script. Auto doesn’t route scripts.
- The SQL sets
@@reservationitself. YourSETdecides. - It’s a graph query. Graph queries need an Enterprise or Enterprise Plus reservation, so Auto never moves one to on-demand or a Standard reservation.
- The query has no price estimate yet, for example because of a syntax error.
- The project’s reservation has prepaid baseline slots, or Querylab.io can’t see the reservation’s size.
- The project’s
reservation_override_modedoesn’t allow on-demand queries. An admin can allow it.
A result served from the query cache isn’t used to learn.
AI tools
Prism AI and connected AI tools use the same routing. On desktop, Settings → MCP → Routing sets where AI tools send their queries, and Let AI tools choose routing lets them pass a route themselves.
Related: Pricing comparison shows a query’s cost on each billing model.