問題文
A 4 billion row table has a numeric column whose values are integers from 0 to 200. It is currently stored as a 64-bit integer. Which type choice is appropriate, and what is the effect?
選択肢
- A 32-bit float, because floating-point types are the most flexible and a 32-bit float still represents every integer in this range exactly while leaving room for fractional values if the definition of the column ever changes to allow them in a future version of the upstream system.
- Keep the 64-bit integer, because narrowing an integer column changes the results of aggregations over 4 billion rows, and the running sum would overflow the narrower type partway through the aggregation.
- A categorical type, since the column has only 201 distinct values.
- An 8-bit integer covers the observed range and cuts the column's footprint to an eighth, provided the ingestion contract guarantees the range will not widen.