# Google Cloud Spanner v1 API - Class ExecuteSqlRequest.Types.QueryOptions (5.13.0-beta07)

5.13.0-beta07 5.13.0-beta06 5.12.0 (latest) 5.11.0 5.10.0 5.9.0 5.8.0 5.7.0 5.6.0 5.5.0 5.4.0 5.3.0 5.2.0 5.1.0 5.0.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.15.1 3.14.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0

    public sealed class ExecuteSqlRequest.Types.QueryOptions : IMessage<ExecuteSqlRequest.Types.QueryOptions>, IEquatable<ExecuteSqlRequest.Types.QueryOptions>, IDeepCloneable<ExecuteSqlRequest.Types.QueryOptions>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Spanner v1 API class ExecuteSqlRequest.Types.QueryOptions.

Query optimizer configuration.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ExecuteSqlRequest.Types.QueryOptions

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types)[QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types)[QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types)[QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Spanner.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)

## Assembly

Google.Cloud.Spanner.V1.dll

## Constructors

### QueryOptions()

    public QueryOptions()

### QueryOptions(QueryOptions)

    public QueryOptions(ExecuteSqlRequest.Types.QueryOptions other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions` |

## Properties

### OptimizerStatisticsPackage

    public string OptimizerStatisticsPackage { get; set; }

An option to control the selection of optimizer statistics package.

This parameter allows individual queries to use a different query
optimizer statistics package.

Specifying `latest` as a value instructs Cloud Spanner to use the latest
generated statistics package. If not specified, Cloud Spanner uses
the statistics package set at the database level options, or the latest
package if the database option isn't set.

The statistics package requested by the query has to be exempt from
garbage collection. This can be achieved with the following DDL
statement:

    ALTER STATISTICS <package_name> SET OPTIONS (allow_gc=false)

The list of available statistics packages can be queried from
`INFORMATION_SCHEMA.SPANNER_STATISTICS`.

Executing a SQL statement with an invalid optimizer statistics package
or with a statistics package that allows garbage collection fails with
an `INVALID_ARGUMENT` error.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### OptimizerVersion

    public string OptimizerVersion { get; set; }

An option to control the selection of optimizer version.

This parameter allows individual queries to pick different query
optimizer versions.

Specifying `latest` as a value instructs Cloud Spanner to use the
latest supported query optimizer version. If not specified, Cloud Spanner
uses the optimizer version set at the database level options. Any other
positive integer (from the list of supported optimizer versions)
overrides the default optimizer version for query execution.

The list of supported optimizer versions can be queried from
`SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS`.

Executing a SQL statement with an invalid optimizer version fails with
an `INVALID_ARGUMENT` error.

See
<https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer>
for more information on managing the query optimizer.

The `optimizer_version` statement hint has precedence over this setting.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |