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

Viewed 128

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?

1 Answers

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.

Related