Class QueryOptions (3.6.0)

public sealed class QueryOptions : IEquatable<QueryOptions>

Immutable class representing query options.

Inheritance

Object > QueryOptions

Implements

IEquatable<QueryOptions>

Namespace

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
TypeDescription
QueryOptions

OptimizerVersion

public string OptimizerVersion { get; }

The query optimizer version configured in the options.

Property Value
TypeDescription
String

Methods

FromProto(ExecuteSqlRequest.Types.QueryOptions)

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

Set query options from the given proto.

Parameter
NameDescription
protoGoogle.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions

The proto to construct QueryOptions from.

Returns
TypeDescription
QueryOptions
Remarks

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

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32
Overrides

ToProto()

public ExecuteSqlRequest.Types.QueryOptions ToProto()

Get proto version of the query options.

Returns
TypeDescription
Google.Cloud.Spanner.V1.ExecuteSqlRequest.Types.QueryOptions

WithOptimizerVersion(String)

public QueryOptions WithOptimizerVersion(string optimizerVersion)

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

Parameter
NameDescription
optimizerVersionString

Optimizer version to set.

Returns
TypeDescription
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.