title: How to interpret STREAMING_TIMELINE_BY_* views in Google Big Query for Streaming Insert cost analysis
body: <p>GBQ (Google Big Query) provides views for streaming insert meta data, see <a href="https://cloud.google.com/bigquery/docs/information-schema-streaming" rel="nofollow noreferrer">STREAMING_TIMELINE_BY_*</a>. I would like to <strong>use this data to understand the billing for &quot;Streaming Inserts&quot;</strong>. However, the numbers don't add ab and I'd like to understand if I made a mistake somewhere.</p>
  <hr />
  <p>One of the data points in the streaming insert meta data view is the <code>total_input_bytes</code>:</p>
  <pre><code>total_input_bytes   
  
  INTEGER 
  
  Total number of bytes from all rows within the 1 minute interval.
  </code></pre>
  <p>In addition, the <a href="https://cloud.google.com/bigquery/pricing#data_ingestion_pricing" rel="nofollow noreferrer">Pricing for data ingestion</a> says:</p>
  <pre><code>Streaming inserts (tabledata.insertAll) 
  
  $0.010 per 200 MB
  
  You are charged for rows that are successfully inserted. Individual rows are calculated using a 1 KB minimum size.
  </code></pre>
  <p>So getting the costs for streamining inserts per day should be possible via</p>
  <pre><code>                 0.01/200 * (SUM(total_input_bytes)/1024/1024)
  
  cost per 200 mb -----^
  
  total bytes in mb ---------------------^
  </code></pre>
  <p>This should be the lower boundary as we disregard any rows with less than 1KB that are rounded up to 1KB.</p>
  <p>Full query:</p>
  <pre><code>SELECT
   project_id,
   dataset_id,
   table_id,
   SUM(total_rows) AS num_rows,
   round(SUM(total_input_bytes)/1024/1024,2) AS num_bytes_in_mb,
   # 0.01$ per 200MB
   # @see https://cloud.google.com/bigquery/pricing#data_ingestion_pricing
   round(0.01*(SUM(total_input_bytes)/1024/1024)/200, 2) AS cost_in_dollar,
   SUM(total_requests) AS num_requests
  FROM
   `region-us`.INFORMATION_SCHEMA.STREAMING_TIMELINE_BY_PROJECT
  where 
    start_timestamp BETWEEN &quot;2021-04-10&quot; and &quot;2021-04-14&quot;
    AND error_code IS NULL
  GROUP BY 1, 2, 3
  ORDER BY table_id asc
  </code></pre>
  <p><a href="https://i.stack.imgur.com/SCK4J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SCK4J.png" alt="" /></a></p>
  <p>However, the results are not reflected in our actual billing report. The billing shows  <strong>less than half the costs</strong> of what I would expect:</p>
  <p><a href="https://i.stack.imgur.com/Atw6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Atw6v.png" alt="" /></a></p>
  <p>Now I wondering if the costs can even be calculated like this.</p>