Skip to content

Commit dff6e46

Browse files
Google APIscopybara-github
authored andcommitted
feat(spanner): add optimizer_statistics_package field in QueryOptions
PiperOrigin-RevId: 360758638
1 parent 479acf6 commit dff6e46

6 files changed

Lines changed: 47 additions & 18 deletions

File tree

google/spanner/v1/keys.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/spanner/v1/query_plan.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/spanner/v1/result_set.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/spanner/v1/spanner.proto

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -435,21 +435,50 @@ message ExecuteSqlRequest {
435435
// This parameter allows individual queries to pick different query
436436
// optimizer versions.
437437
//
438-
// Specifying "latest" as a value instructs Cloud Spanner to use the
438+
// Specifying `latest` as a value instructs Cloud Spanner to use the
439439
// latest supported query optimizer version. If not specified, Cloud Spanner
440-
// uses optimizer version set at the database level options. Any other
440+
// uses the optimizer version set at the database level options. Any other
441441
// positive integer (from the list of supported optimizer versions)
442442
// overrides the default optimizer version for query execution.
443+
//
443444
// The list of supported optimizer versions can be queried from
444-
// SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
445-
// with an invalid optimizer version will fail with a syntax error
446-
// (`INVALID_ARGUMENT`) status.
445+
// SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS.
446+
//
447+
// Executing a SQL statement with an invalid optimizer version fails with
448+
// an `INVALID_ARGUMENT` error.
449+
//
447450
// See
448451
// https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
449452
// for more information on managing the query optimizer.
450453
//
451454
// The `optimizer_version` statement hint has precedence over this setting.
452455
string optimizer_version = 1;
456+
457+
// Query optimizer statistics package to use.
458+
//
459+
// This parameter allows individual queries to use a different query
460+
// optimizer statistics.
461+
//
462+
// Specifying `latest` as a value instructs Cloud Spanner to use the latest
463+
// generated statistics package. If not specified, Cloud Spanner uses
464+
// statistics package set at the database level options, or latest if
465+
// the database option is not set.
466+
//
467+
// The statistics package requested by the query has to be exempt from
468+
// garbage collection. This can be achieved with the following DDL
469+
// statement:
470+
//
471+
// ```
472+
// ALTER STATISTICS <package_name> SET OPTIONS (allow_gc=false)
473+
// ```
474+
//
475+
// The list of available statistics packages can be queried from
476+
// `SPANNER_SYS.OPTIMIZER_STATISTICS_PACKAGES`.
477+
//
478+
// Executing a SQL statement with an invalid optimizer statistics package
479+
// or with statistics package that allows garbage collection fails with
480+
// an `INVALID_ARGUMENT` error.
481+
string optimizer_statistics_package = 2;
453482
}
454483

455484
// Mode in which the statement must be processed.

google/spanner/v1/transaction.proto

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
9393
// [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the
9494
// transaction.
9595
//
96-
// ### Semantics
96+
// ## Semantics
9797
//
9898
// Cloud Spanner can commit the transaction if all read locks it acquired
9999
// are still valid at commit time, and it is able to acquire write
@@ -106,7 +106,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
106106
// use Cloud Spanner locks for any sort of mutual exclusion other than
107107
// between Cloud Spanner transactions themselves.
108108
//
109-
// ### Retrying Aborted Transactions
109+
// ## Retrying Aborted Transactions
110110
//
111111
// When a transaction aborts, the application can choose to retry the
112112
// whole transaction again. To maximize the chances of successfully
@@ -122,7 +122,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
122122
// instead, it is better to limit the total amount of wall time spent
123123
// retrying.
124124
//
125-
// ### Idle Transactions
125+
// ## Idle Transactions
126126
//
127127
// A transaction is considered idle if it has no outstanding reads or
128128
// SQL queries and has not started a read or SQL query within the last 10
@@ -172,7 +172,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
172172
//
173173
// Each type of timestamp bound is discussed in detail below.
174174
//
175-
// ### Strong
175+
// ## Strong
176176
//
177177
// Strong reads are guaranteed to see the effects of all transactions
178178
// that have committed before the start of the read. Furthermore, all
@@ -188,7 +188,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
188188
//
189189
// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
190190
//
191-
// ### Exact Staleness
191+
// ## Exact Staleness
192192
//
193193
// These timestamp bounds execute reads at a user-specified
194194
// timestamp. Reads at a timestamp are guaranteed to see a consistent
@@ -210,7 +210,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
210210
// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and
211211
// [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness].
212212
//
213-
// ### Bounded Staleness
213+
// ## Bounded Staleness
214214
//
215215
// Bounded staleness modes allow Cloud Spanner to pick the read timestamp,
216216
// subject to a user-provided staleness bound. Cloud Spanner chooses the
@@ -240,7 +240,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
240240
// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and
241241
// [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp].
242242
//
243-
// ### Old Read Timestamps and Garbage Collection
243+
// ## Old Read Timestamps and Garbage Collection
244244
//
245245
// Cloud Spanner continuously garbage collects deleted and overwritten data
246246
// in the background to reclaim storage space. This process is known

google/spanner/v1/type.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)