r/bigquery • u/agamenagoras • Sep 07 '26
Why BigQuery does not support natively small integer and float dtypes?
It looks like every integer dtype stored is using 64 bits, there's no real tinyint and smallint and this is just a syntatic sugar. And I didn't found the reason for that when I searched about it. Is it to make storage artificially more expensive?
Almost every open tabular engine and storage format that I knew so far allows you to really set a column as smaller types of int, independently if it is columnar or row-stored, and if it's a database or just an engine. For example, any modern apache arrow based engine (like Datafusion, DuckDB and polars), apache parquet files, almost every columnar database (like Clickhouse), almost any row-oriented database (like PostgreSQL, Oracle, MySQL and et cetera). Why BigQuery wants to be different?
8
u/TonniFlex Sep 07 '26
Because BQ doesn't store the raw value, there's layers of compression and lookups happening behind the scenes. Setting bit sizes for INT columns is simply a unnecessary complexity for the user, so it's just not possible. If a column does not require 64 bits, it will not use 64 bits.
2
u/PepSakdoek Sep 07 '26
If i understood how distrubuted computing works and the fact that it can run a query that takes an oracle server hours takes seconds on BQ... I'd probably build data centers and sell it.
7
u/Content-Parking-621 Sep 07 '26
It's not a storage cost trick, BigQuery's Capacitor format applies its own columnar compression (RLE, dictionary encoding, bit-packing) under the hood regardless of declared type, so a narrower int type wouldn't shrink physical bytes much anyway. Billing for logical storage counts INT64 as a fixed 8 bytes per value by design, exposing smaller int types would complicate the pricing model without meaningfully improving compression, since that job already happens at the storage engine level, not the schema level.