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

# aggregate_unique

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unique.rs#L56-L71)
pub async fn [aggregate\_unique](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unique.md#method.aggregate_unique)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), offset: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html), limit: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUniqueResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Find unique values in a columnReturns all the unique values from a particular column (specified by `column_name`) of a particular table or view (specified by `table_name`). If `column_name` is a numeric column, the values will be in `binary_encoded_response`. Otherwise if `column_name` is a string column, the values will be in `json_encoded_response`. The results can be paged via `offset` and `limit` parameters.

```text theme={null}
{"limit":"10","sort_order":"descending"}
```

The response is returned as a dynamic schema. For details see: dynamic schemas documentation.If a result\_table name is specified in the `options`, the results are stored in a new table with that name–no results are returned in the response. Both the table name and resulting column name must adhere to standard naming conventions; any column expression will need to be aliased. If the source table’s shard key is used as the `column_name`, the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available if the value of `column_name` is an unrestricted-length string.

##### Arguments

<ul>
  <li>`table_name` - Name of an existing table or view on which the operation will be performed, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
  <li>`column_name` - Name of the column or an expression containing one or more column names on which the unique function would be applied.</li>
  <li>`offset` - A positive integer indicating the number of initial results to skip (this can be useful for paging through the results).</li>
  <li>`limit` - A positive integer indicating the maximum number of results to be returned, or END\_OF\_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server’s own limit, defined by the max\_get\_records\_size parameter in the server configuration. Use `has_more_records` to see if more records exist in the result to be fetched, and `offset` and `limit` to request subsequent pages of results.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unique.rs#L119-L144)
pub async fn [aggregate\_unique\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unique.md#method.aggregate_unique_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), offset: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html), limit: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html), options: [AggregateUniqueRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUniqueResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Find unique values in a columnReturns all the unique values from a particular column (specified by `column_name`) of a particular table or view (specified by `table_name`). If `column_name` is a numeric column, the values will be in `binary_encoded_response`. Otherwise if `column_name` is a string column, the values will be in `json_encoded_response`. The results can be paged via `offset` and `limit` parameters.

```text theme={null}
{"limit":"10","sort_order":"descending"}
```

The response is returned as a dynamic schema. For details see: dynamic schemas documentation.If a result\_table name is specified in the `options`, the results are stored in a new table with that name–no results are returned in the response. Both the table name and resulting column name must adhere to standard naming conventions; any column expression will need to be aliased. If the source table’s shard key is used as the `column_name`, the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available if the value of `column_name` is an unrestricted-length string.

##### Arguments

<ul>
  <li>`table_name` - Name of an existing table or view on which the operation will be performed, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
  <li>`column_name` - Name of the column or an expression containing one or more column names on which the unique function would be applied.</li>
  <li>`offset` - A positive integer indicating the number of initial results to skip (this can be useful for paging through the results).</li>
  <li>`limit` - A positive integer indicating the maximum number of results to be returned, or END\_OF\_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server’s own limit, defined by the max\_get\_records\_size parameter in the server configuration. Use `has_more_records` to see if more records exist in the result to be fetched, and `offset` and `limit` to request subsequent pages of results.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unique.rs#L148-L166)
pub async fn [aggregate\_unique\_request](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unique.md#method.aggregate_unique_request)( \&self, request: &[AggregateUniqueRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUniqueResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUniqueRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest) to the `/aggregate/unique` endpoint and decodes the records it returns. Only binary encoding is supported.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unique.rs#L170-L181)
pub async fn [aggregate\_unique\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unique.md#method.aggregate_unique_raw)( \&self, request: &[AggregateUniqueRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawAggregateUniqueResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawAggregateUniqueResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUniqueRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest) to the `/aggregate/unique` endpoint, returning the response as the server sends it.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unique.rs#L185-L197)
pub async fn [aggregate\_unique\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unique.md#method.aggregate_unique_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[AggregateUniqueRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawAggregateUniqueResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawAggregateUniqueResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUniqueRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUniqueRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.