Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Billing bytes changes if insert into table

I have a select that, alone, is billing 1.61 GB

cleuson_0-1733921369680.png

However, if I insert the data into a table, it jumps to 22.65GB

cleuson_1-1733921452057.png

Why? I thought insert data was free, and I would only paying to read the data

0 4 161
4 REPLIES 4

Hi @cleuson,

Welcome to Google Cloud Community!

In your second query, the reason why your query increased to 22.65GB is because your query result is inserted to the target table which adds more rows and expands the table. This will occupy more storage space in BigQuery while your first query only reads the data from your data source. 

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

That´s not true.
I created a new table as a test, with the same select, and it only took 3.8gb

cleuson_0-1734353878831.png

 

Hi @cleuson,

To clarify regarding INSERT operation, if the user provides values in a simple INSERT statement, no charges will be incurred since there is no data processing or bytes that will be scanned. For example, you can have this simple DML INSERT statement which provides a direct value from a user. 

On the other hand, if a user provided an INSERT statement with subquery, the user will be billed since there will be data that will be scanned as also discussed in this documentation

You can also check BigQuery pricing for more details and insights.


Hi @cleuson  ,

Query Execution (SELECT):
The SELECT query simply scans the table and returns the result.
The query does not alter or store anything permanently; it only processes the data temporarily.
The 1.61 GB of scanned data represents the raw size of the data that Big Query needs to read to return the results of your query. This does not reflect the physical storage of data in Big Query, only how much data is accessed during the query execution.

Inserting Data Into a Table (INSERT INTO):
When you run the INSERT INTO, Big Query writes the data to the table. The data now resides in Big Query's persistent storage, which involves additional overhead, such as data compression, encoding, metadata, and possibly partitioning or clustering.
The 22.95 GB of storage you're seeing represents the physical storage of the data in the table, which may involve additional compression or storage overhead that doesn't apply when you're simply reading the data.

so that insert query consuming more memory space instead of select query.