BigQuery pricing model cost us $10k in 22 seconds
linkedin.com
linkedin.com
The user even highlights numerous places in the documentation and hints in the UI which communicate BQ pricing model... so it's interesting they decide to post that it's hidden or dark pattern.
Bigquery has a feature in pre-release stage which will be useful for a limit-like experience while incurring much lower cost.
All the cloud providers have foot-guns for the unwary or not-yet-bitten.
Although I use GCP all the time, were I to set something up for a friend I would not turn to GCP because of the fear of expensive oopsies.
E.g. I wish there were project and per-query options to limit max slot hours and max bytes scanned per query etc.
I regularly run really big queries in BQ that can take 10x the slots on some runs just because of 'BQ weather' and slot contention.
While this specific error is something we know to avoid, I'm sure quotas have helped us avoid the pain of other errors. So I'm somewhat sympathetic.
I think it's important to read the language of and judgements in the post in the context of someone who just got a large unexpected bill (expensive lesson).
This post is not eliciting sympathy. They're data consultants, who don't understand a very basic and fundamental aspect of the tool that they're using and recommending. If you're a consultant you have a responsibility to RTFM, and the docs are clear that LIMIT doesn't prune queries in BigQuery. And, also, the interface tells you explicitly how much data you're gonna query before you run it.
This post is also blaming Google rather than accepting their own part in this folly, and event admits the docs are clear on this matter. Cost-control in BigQuery is not difficult. One of the tradeoffs of BQ's design is that it must be configred explicitly, there's no "smart" or "automatic" query pruning, but that also makes it easier to guarantee and predict cost over time as new data arrives.
I don’t know the query they used, but limit can limit data scanned.
It’s been a long time since I used BQ, but I remember their query optimizer not being particularly advanced, so you had to be really careful where you put the limit.
> BigQuery charges based on referenced data, not processed data!
(emphasis theirs) and linked to a doc that says:
> When you run a query, you're charged according to the data processed in the columns you select, even if you set an explicit `LIMIT` on the results.
I would have interpreted the latter to mean something else, like that you get charged for scanning all rows when you do something like the following:
select a, sum(b) as b_sum from table group by a order by b_sum limit 10;
...because my post-group LIMIT clause doesn't actually prevent it from needing all rows. But their query should genuinely not need all rows. It does need all partitions. I suppose if they have way too many partitions (such that each is <= the minimum fetch size, note: see edit below) then GCP genuinely needs to fetch all the data. Otherwise I am surprised they were charged so much.edit: a caveat on "such that each is <= the minimum fetch size", I suppose their "select *" together with the columnar format might mean that I should word this as something like each (partition, column) is <= the minimum fetch size.