Reputation: 13078
If I have a column with "numbers" in it, does the storage cost change if the schema specifies that column to be an INTEGER vs STRING?
Example: I have dozens of terabytes of numeric data stored as STRING. If I need to perform math on that column, it's easy enough to cast at query time. But if I change the schema, will the data be stored any differently such that it'll consume less bits at rest, and thus, cost me less?
Upvotes: 0
Views: 170
Reputation: 5503
Given that BigQuery charge STRING/INT64 column as
STRING | 2 bytes + the UTF-8 encoded string size
INT64 | 8 bytes
Not sure how are you planning to encode your numeric data into string, from my gut feeling, unless you have most of the numeric value less than 16 bit, you don't gain much by storing them as STRING than as INT64.
But if you do have small numbers, it is not only saving the cost on storage, but also saving the cost on query if you pay by scanned bytes, which may be more saving than on storage if you scan your data a lot.
Reference: https://cloud.google.com/bigquery/pricing#data
Upvotes: 1