> ## 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.

# collect_statistics

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/collect_statistics.rs#L27-L38)
pub async fn [collect\_statistics](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/collect-statistics.md#method.collect_statistics)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_names: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CollectStatisticsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Collect statistics on a column.Collect statistics for a column(s) in a specified table.

##### Arguments

<ul>
  <li>`table_name` - Name of a table, in \[schema\_name.]table\_name format, using standard name resolution rules. Must be an existing table. A value of ‘’ collects statistics on every user table the caller may read (excluding system schemas, views, and temporary tables); when used, `column_names` must be ‘’.</li>
  <li>`column_names` - List of one or more column names in `table_name` for which to collect statistics (cardinality, mean value, etc.). A single entry of ‘\*’ expands to every collectable column on the table (geometry, vector, JSON, and array columns are skipped).</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/collect_statistics.rs#L57-L75)
pub async fn [collect\_statistics\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/collect-statistics.md#method.collect_statistics_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_names: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, options: [CollectStatisticsRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CollectStatisticsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Collect statistics on a column.Collect statistics for a column(s) in a specified table.

##### Arguments

<ul>
  <li>`table_name` - Name of a table, in \[schema\_name.]table\_name format, using standard name resolution rules. Must be an existing table. A value of ‘’ collects statistics on every user table the caller may read (excluding system schemas, views, and temporary tables); when used, `column_names` must be ‘’.</li>
  <li>`column_names` - List of one or more column names in `table_name` for which to collect statistics (cardinality, mean value, etc.). A single entry of ‘\*’ expands to every collectable column on the table (geometry, vector, JSON, and array columns are skipped).</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/collect_statistics.rs#L78-L89)
pub async fn [collect\_statistics\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/collect-statistics.md#method.collect_statistics_raw)( \&self, request: &[CollectStatisticsRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CollectStatisticsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`CollectStatisticsRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsRequest) to the `/collect/statistics` endpoint.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/collect_statistics.rs#L93-L105)
pub async fn [collect\_statistics\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/collect-statistics.md#method.collect_statistics_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[CollectStatisticsRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CollectStatisticsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`CollectStatisticsRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.CollectStatisticsRequest) 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.