How to Cut BigQuery Costs With an AI Data Engineering Agent
If you’ve been wondering how to cut BigQuery costs on legacy pipelines without a months-long rewrite, Vodafone Czech Republic just gave European data teams a useful playbook. In a Google Cloud case study published on 21 November 2026, the company reported 30% lower pipeline costs, run times cut roughly in half and 90% less migration effort after using Google’s Data Engineering Agent inside Dataform.
The interesting part isn’t the headline numbers. It’s what went wrong first: when the agent parallelised old stored procedures, costs went up, until the team cached intermediate results in materialized views. This guide turns that lesson into a repeatable process you can run on your own warehouse.
What You Need Before You Start
BigQuery and Dataform access. The Data Engineering Agent is a Gemini-powered assistant that works inside Dataform. Check that it’s available in your project and region before you plan around it. See the Dataform documentation for setup.
A Git repository for pipeline code. Dataform works with Git. Every agent change should land as a reviewable commit.
Permission to query job metadata. You’ll need read access to INFORMATION_SCHEMA.JOBS views to measure what pipelines actually cost.
A data owner for each pipeline. Someone in the business who can say whether the output is right. Engineers can check row counts. Only owners know if a churn number makes sense.
Awareness of your data residency. If you process personal data under GDPR, confirm your datasets and any agent processing stay in the regions your DPO has approved.
Step 1: Find Your Most Expensive Procedures
Don’t start with the oldest code. Start with the code that costs the most. Query your job history to see where bytes are billed:
SELECT
user_email,
LEFT(query, 120) AS query_start,
COUNT(*) AS runs,
SUM(total_bytes_billed) / POW(1024, 4) AS tib_billed,
SUM(total_slot_ms) / 1000 / 3600 AS slot_hours
FROM `region-eu`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
WHERE creation_time > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
AND job_type = 'QUERY'
GROUP BY user_email, query_start
ORDER BY tib_billed DESC
LIMIT 25;
Change the region qualifier to match where your data lives. The INFORMATION_SCHEMA jobs reference lists every available column.
Look for the pattern Vodafone had: long stored procedures (theirs ran to 2,000 to 3,000 lines), running step by step, on a schedule. Pick three to five with clear owners. That’s your pilot.
One more check before moving on: find out whether your project uses on-demand pricing (billed per byte scanned) or capacity pricing with reserved slots. The savings levers differ. On-demand teams win mostly by scanning fewer bytes. Capacity teams win by using fewer slot hours, which frees reserved capacity for other workloads or lets you shrink the reservation. Your finance contact can usually confirm this in five minutes, and it changes which metric you should treat as the headline in Step 2.
Step 2: Capture a Hard Baseline
For each pilot procedure, record runtime, bytes billed, slot hours and monthly cost over at least two weeks. Also save a snapshot of its output tables for a fixed set of input dates. You’ll use those snapshots to prove parity later.
This step feels boring. It’s also the only thing that turns “it seems faster” into “it’s 30% cheaper.” Vodafone’s case study doesn’t publish absolute costs, which is exactly why your own baseline matters more than their percentage.
Step 3: Let the Agent Refactor, With Clear Instructions
In Dataform, ask the Data Engineering Agent to convert one stored procedure into a pipeline of separate, dependent actions. According to the Google Cloud case study, Vodafone used the agent to break sequential logic into independent steps that could run in parallel, while handling dependencies and execution logging.
Be specific in your prompts. Vodafone’s team got better results when they told the agent exactly which staging tables to parallelise instead of letting it decide. A good instruction looks like: “Split this procedure into Dataform actions. Steps 3, 4 and 5 read only from stg_customers and can run in parallel. Keep step 6 dependent on all three. Add a description to each action explaining its business purpose.”
Treat the output like a pull request from a fast junior engineer. Read it. Question it. Don’t merge on trust.
Step 4: Stop Parallel Steps From Rescanning the Same Tables
Here’s the trap. BigQuery on-demand pricing charges for bytes scanned. If five parallel steps each read the same 2 TB raw table, you pay to scan it five times. Faster job, bigger bill. Vodafone hit exactly this before fixing it.
The fix is to compute shared intermediate results once and let downstream steps read the small result. Vodafone used BigQuery materialized views for this. Depending on your query shapes, a staged table built once per run can work too, since materialized views have restrictions on which SQL they support.
After the change, rerun the job-history query from Step 1, filtered to the new pipeline. Compare bytes billed per step against the baseline. Partitioning and clustering large source tables on the columns you filter by will cut scanned bytes further, and the agent can suggest those changes if you ask.
Step 5: Prove Parity, Then Switch Over
Vodafone reports 1:1 logic parity between old procedures and new pipelines. Get the same evidence for yours. Run old and new versions on identical inputs and compare outputs with a full-row check:
SELECT COUNT(*) AS mismatched_rows FROM (
(SELECT * FROM legacy.output_table EXCEPT DISTINCT SELECT * FROM modern.output_table)
UNION ALL
(SELECT * FROM modern.output_table EXCEPT DISTINCT SELECT * FROM legacy.output_table)
);
Zero is the target. Anything else gets investigated, usually floating point rounding, NULL handling or ordering logic. Have the data owner sign off on a sample of business numbers too.
Then run both pipelines in parallel for one or two cycles, switch dashboards to the new output, and decommission the old procedure. Record before and after costs in a short summary for finance.
Common Mistakes to Avoid
Assuming parallel means cheaper. It often means more expensive on on-demand pricing. Watch bytes scanned, not just runtime.
Skipping parity tests because the agent “explained” its logic. Explanations aren’t evidence. Row-level comparison is.
Migrating everything at once. Vodafone is planning a phased rollout across the Czech Republic, Romania, Ireland, Germany and the UK, plus later moves for SAS, BTEQ and MicroStrategy code, as Compsmag summarised. Phasing is the point. Learn on a few pipelines, then scale.
Ignoring documentation. Ask the agent to describe every action in plain language. Under GDPR, clear lineage for personal data is something auditors ask for, and a 3,000-line procedure nobody understands is the opposite of that.
Key Takeaways
- Target cost, not age: Use
INFORMATION_SCHEMA.JOBSto find the procedures that bill the most bytes. - Baseline everything: Runtime, bytes billed, slot hours and output snapshots before any change.
- Guide the agent: Tell it which steps to parallelise and require plain-language descriptions.
- Cache shared work: Materialized views or staged tables stop parallel steps from rescanning raw data.
- Prove parity: Row-level EXCEPT checks and owner sign-off before switching dashboards.
Need Expert Help?
If this feels like a lot to manage alone, TecniForge can handle the heavy lifting. Our team specializes in custom software development and AI integration, and our data engineers modernise legacy warehouses into cost-aware, well-documented pipelines. Get in touch with our experts.
Also read: Vodafone’s Data Engineering Agent Win: 30% Cheaper Pipelines, 2x Faster Runs, our earlier coverage on why this matters today.
Try this tomorrow morning: run the Step 1 query on your own project. If your top five queries surprise you, and they usually do, you’ve already found your first pilot.
Discover more from TecniForge
Subscribe to get the latest posts sent to your email.