> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/modeling/dimensions/parameters/custom-primary-key-sql-for-quick-aggs",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# custom_primary_key_sql_for_quick_aggs

> Defines a custom primary key for aggregate measures where a primary key is applicable.

This is useful for ensuring that [symmetric aggregates](/analyze-explore/sql/symmetric-aggregates) are computed correctly, especially for [nested columns (`structs`)](/analyze-explore/sql/symmetric-aggregates#handling-fan-out-from-unnested-columns) which are common in Google BigQuery.

## Syntax

```yaml theme={null}
<dimension_name>:
  custom_primary_key_sql_for_quick_aggs: ${<field_reference>}
```

## Properties

<ParamField path="dimension_name" type="object">
  The name of the dimension. Dimension names must:

  * Be unique within the view
  * Start with a letter
  * Contain only alphanumeric characters and underscores

  <Expandable title="dimension_name properties" defaultOpen="true">
    <ParamField path="custom_primary_key_sql_for_quick_aggs" type="string">
      A field reference specifying the custom primary key to use for quick aggregate calculations.
    </ParamField>
  </Expandable>
</ParamField>

## Examples

```yaml title="Nested column with custom primary key" theme={null}
dimensions:
  order_id:
    primary_key: true
  order_items: {}
  order_item_price:
    parent_field: order_items
    nested_on_field: order_items
    custom_primary_key_sql_for_quick_aggs: ${order_item_id}
    sql: price

measures:
  total_price:
    sql: ${order_item_price}
    aggregate_type: sum_distinct_on
    custom_primary_key_sql: ${order_item_id}
```
