Snowflake data types define how numeric, text, date/time, and semi-structured values are stored, indexed, and processed.
Choose NUMBER for exact precision (e.g., monetary totals) and FLOAT for scientific or approximate calculations. NUMBER(38,0) handles large integers like order IDs. Use DECIMAL as an alias of NUMBER to keep code portable.
Use VARCHAR without a length limit for free-form text. For shorter codes, CHAR(N) fixes storage to N bytes but is rarely needed.Always set COLLATE to ensure case-insensitive searches when required.
DATE stores calendar dates; TIME captures clock time; TIMESTAMP_NTZ stores both without a time zone; TIMESTAMP_TZ keeps the offset. Favor TIMESTAMP_TZ for global ecommerce apps to avoid math on offsets.
Yes. VARIANT stores semi-structured data like JSON, Avro, or XML. Use OBJECT and ARRAY for stricter typing when you know the structure.Query with the colon operator (product_specs:color::string).
Use CAST(value AS target_type) or the :: shorthand. Keep an eye on rounding behavior when casting FLOAT to NUMBER.
1) Declare column precision only when necessary; wider columns compress well. 2) Prefer NUMBER over FLOAT for currency. 3) Index complex filters with CLUSTER BY, not data type tweaks.
.
No. Omitting length defaults to the maximum and has no storage penalty.
Querying VARIANT is slightly slower, but clustering keys on frequently accessed paths keeps performance predictable.
Use TIMESTAMP_TZ and always insert with the +00:00 offset.