Google.Cloud.Spanner.Data - Class QueryOptions (4.4.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 > QueryOptions

Namespace

GoogleCloudGoogle.Cloud.SpannerData

Assembly

Google.Cloud.Spanner.Data.dll

Properties

Empty

public static QueryOptions Empty { get; }

Creates query options without specifying any options.

Property Value
TypeDescription
QueryOptions

OptimizerStatisticsPackage

public string OptimizerStatisticsPackage { get; }

The query optimizer statistics package configured in the options.

Property Value
TypeDescription
string

OptimizerVersion

public string OptimizerVersion { get; }

The query optimizer version configured in the options.

Property Value
TypeDescription
string

Methods

FromProto(QueryOptions)

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

Set query options from the given proto.

Parameter
NameDescription
protoExecuteSqlRequestTypesQueryOptions

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
int
Overrides

ToProto()

public ExecuteSqlRequest.Types.QueryOptions ToProto()

Get proto version of the query options.

Returns
TypeDescription
ExecuteSqlRequestTypesQueryOptions

WithOptimizerStatisticsPackage(string)

public QueryOptions WithOptimizerStatisticsPackage(string optimizerStatisticsPackage)

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

Parameter
NameDescription
optimizerStatisticsPackagestring

Optimizer statistics package to set.

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