'Is there any reason or advantage to specify string column length in BigQuery?

I am new to BQ and experienced in OLTP RDBMS, I found the data in BQ for my company are mostly in STRING type while it was VARCHAR(255) or even less in the OLTP DB.

Is there any reason or advantage to specify string column length in BigQuery?



Solution 1:[1]

BigQuery does support parameterize data types: reference

If you have a use-case in your business logic where length of string is used to do some validation of data then you can always use strict parameter for defining that column.

Here is a sample:

CREATE TABLE `{YOUR_TEST_TABLE_NAME}`
(
 val STRING(8)
)

insert into `{YOUR_TEST_TABLE_NAME}` (val) values ('abcdedfhij')

Above insert will fail as length is more than 8.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1