Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many bytes in BigQuery types

How many bytes do the following types take up in BigQuery:

  • Timestamp
  • Datetime
  • Date

My guess was that date could be stored in 2 bytes, and a timestamp perhaps 8, but I wasn't sure about that and it is not mentioned on the https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types page.

like image 926
FI-Info Avatar asked Sep 07 '26 23:09

FI-Info


1 Answers

The size of BigQuery's data types is as follows:

Data type     Size
INT64/INTEGER 8 bytes
FLOAT64/FLOAT 8 bytes
NUMERIC       16 bytes
BOOL/BOOLEAN  1 byte
STRING        2 bytes + the UTF-8 encoded string size
BYTES         2 bytes + the number of bytes in the value
DATE          8 bytes
DATETIME      8 bytes
TIME          8 bytes
TIMESTAMP     8 bytes
STRUCT/RECORD 0 bytes + the size of the contained fields
GEOGRAPHY     16 bytes + 24 bytes * the number of vertices in the geography type (you can verify the number of vertices using the ST_NumPoints function)  

Null values for any data type are calculated as 0 bytes.

A repeated column is stored as an array, and the size is calculated based on the number of values. For example, an integer column (INT64) that is repeated (ARRAY) and contains 4 entries is calculated as 32 bytes (4 entries x 8 bytes).

See more details in Data size calculation section of Pricing documentation

like image 111
Mikhail Berlyant Avatar answered Sep 11 '26 20:09

Mikhail Berlyant