Loading section...

STRUCT: Embedded Objects

Concepts: dmStructType

Grouping Related Fields Into One Column A STRUCT is a named group of fields embedded inside a row. Instead of storing address_line1, address_city, address_state, address_zip as four separate columns, you store them as one address STRUCT with four sub-fields. Accessing them uses dot notation: address.city. STRUCTs do not add rows. They add structure within a row. The fact table row count stays the same. This is the key difference from ARRAY (which can add logical rows via UNNEST). Functionally, both approaches work. The STRUCT version is cleaner when you have many related field groups: shipping_address, billing_address, contact_info. Without STRUCTs, you end up with 12 flat columns that are hard to visually group. With STRUCTs, you have 3 columns, each with sub-fields. Schema evolution trap