# Google.Cloud.Spanner.Data - Class 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 QueryOptions : IEquatable<QueryOptions>

Reference documentation and code samples for the Google.Cloud.Spanner.Data class QueryOptions.

Immutable class representing query options.

## Inheritance

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

## Implements

[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions)

## Inherited Members

[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.Data](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data)

## Assembly

Google.Cloud.Spanner.Data.dll

## Properties

### Empty

    public static QueryOptions Empty { get; }

Creates query options without specifying any options.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions` |   |

### OptimizerStatisticsPackage

    public string OptimizerStatisticsPackage { get; }

The query optimizer statistics package configured in the options.

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

### OptimizerVersion

    public string OptimizerVersion { get; }

The query optimizer version configured in the options.

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

## Methods

### FromProto(QueryOptions)

    public static QueryOptions FromProto(ExecuteSqlRequest.Types.QueryOptions proto)

Set query options from the given proto.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `proto` | `Google.Cloud.Spanner.V1.ExecuteSqlRequestGoogle.Cloud.Spanner.V1.ExecuteSqlRequest.TypesGoogle.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions` The proto to construct [QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions) from. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions` |   |

**Remarks** The given proto should not be null. The given proto is cloned.

### GetHashCode()

    public override int GetHashCode()

Serves as the default hash function.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | A hash code for the current object. |

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### ToProto()

    public ExecuteSqlRequest.Types.QueryOptions ToProto()

Get proto version of the query options.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google.Cloud.Spanner.V1.ExecuteSqlRequestGoogle.Cloud.Spanner.V1.ExecuteSqlRequest.TypesGoogle.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions` |   |

### WithOptimizerStatisticsPackage(string)

    public QueryOptions WithOptimizerStatisticsPackage(string optimizerStatisticsPackage)

Clones the options and sets the optimizer statistics package to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `optimizerStatisticsPackage` | `https://learn.microsoft.com/dotnet/api/system.string` Optimizer statistics package to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions` | A clone of the options with the updated optimizer statistics package. |

**Remarks** The parameter allows individual queries to pick different query
optimizer statistics packages.

Specifying "latest" as a value instructs Cloud Spanner to use the
latest supported query optimizer statistics package. If not specified,
Cloud Spanner uses the optimizer statistics package set at the database
level options. Any other supported statistics package value overrides
the default optimizer statistics package for query execution.

### WithOptimizerVersion(string)

    public QueryOptions WithOptimizerVersion(string optimizerVersion)

Clones the options and sets the optimizer version to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `optimizerVersion` | `https://learn.microsoft.com/dotnet/api/system.string` Optimizer version to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions` | A clone of the options with the updated optimizer version. |

**Remarks** The 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 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.