Class QueryOptions
Immutable class representing query options.
Implements
Namespace: Google.Cloud.Spanner.Data
Assembly: Google.Cloud.Spanner.Data.dll
Syntax
public sealed class QueryOptions : IEquatable<QueryOptions>
Properties
Empty
Creates query options without specifying any options.
Declaration
public static QueryOptions Empty { get; }
Property Value
Type | Description |
---|---|
QueryOptions |
OptimizerStatisticsPackage
The query optimizer statistics package configured in the options.
Declaration
public string OptimizerStatisticsPackage { get; }
Property Value
Type | Description |
---|---|
string |
OptimizerVersion
The query optimizer version configured in the options.
Declaration
public string OptimizerVersion { get; }
Property Value
Type | Description |
---|---|
string |
Methods
FromProto(QueryOptions)
Set query options from the given proto.
Declaration
public static QueryOptions FromProto(ExecuteSqlRequest.Types.QueryOptions proto)
Parameters
Type | Name | Description |
---|---|---|
ExecuteSqlRequest.Types.QueryOptions | proto | The proto to construct QueryOptions from. |
Returns
Type | Description |
---|---|
QueryOptions |
Remarks
The given proto should not be null. The given proto is cloned.
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
ToProto()
Get proto version of the query options.
Declaration
public ExecuteSqlRequest.Types.QueryOptions ToProto()
Returns
Type | Description |
---|---|
ExecuteSqlRequest.Types.QueryOptions |
WithOptimizerStatisticsPackage(string)
Clones the options and sets the optimizer statistics package to the given value.
Declaration
public QueryOptions WithOptimizerStatisticsPackage(string optimizerStatisticsPackage)
Parameters
Type | Name | Description |
---|---|---|
string | optimizerStatisticsPackage | Optimizer statistics package to set. |
Returns
Type | Description |
---|---|
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)
Clones the options and sets the optimizer version to the given value.
Declaration
public QueryOptions WithOptimizerVersion(string optimizerVersion)
Parameters
Type | Name | Description |
---|---|---|
string | optimizerVersion | Optimizer version to set. |
Returns
Type | Description |
---|---|
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.