📊 Automatically replaces BigQuery’s query size estimate (GB/TB) with the estimated cost in USD.
Google BigQuery displays a message like:
"This query will process 11.37 GB when run." or "This query will process 1.12 TB when run."
This script dynamically replaces that text with the estimated cost based on Google’s on-demand pricing.
💰 Cost Calculation: $6.25 per TB processed (handles both GB and TB estimates)
- ✔ Real-time cost calculation as you type queries
- ✔ MutationObserver support for dynamic updates
- ✔ Lightweight & fast, no external dependencies
- ✔ Works in Chrome, Firefox, Edge, Brave, & Safari
This script works with:
- ViolentMonkey (Recommended)
- TamperMonkey
🔹 From GreasyFork: BigQuery Cost Estimator
🔹 From GitHub: Click Here to install manually.
- The GB/TB estimate will be replaced with the cost estimate automatically.
- Finds the GB/TB estimate in BigQuery’s UI.
- Extracts the numeric value and unit from the message.
- Calculates the cost using
$6.25 per TB. - Replaces the text dynamically (consolidates duplicates when BigQuery renders the message multiple times).
📌 Example Calculations:
GB: 11.37 GB → Cost = (11.37 ÷ 1024) × 6.25 = $0.07
TB: 1.12 TB → Cost = 1.12 × 6.25 = $7.00
BigQuery now displays:
"Estimated cost: $0.07" or "Estimated cost: $7.00"
- Uses MutationObserver (childList and characterData) to detect changes in BigQuery’s UI.
- Finds the status element via known selectors first, then a content-based DOM search for "This query will process" (handles UI structure changes).
- When BigQuery renders the estimate in multiple elements, replaces the common parent to avoid duplicate display.
- Does not interfere with BigQuery’s functionality.
Want to improve this script? PRs are welcome!
- Fork this repo
- Clone your fork
git clone https://github.com/[YOUR GITHUB NAME]/bigquery-cost-estimator.git- Make changes & push
git commit -m "Improved cost calculation"
git push origin main- Submit a Pull Request (PR)
This project is licensed under the MIT License – you’re free to use, modify, and distribute it!
- 📜 GreasyFork Script: BigQuery Cost Estimator
- 🏗 GitHub Repository: GitHub
- 🌎 Google BigQuery Pricing: BigQuery Pricing Docs
