An option to control the selection of optimizer version.
This 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.
The list of supported optimizer versions can be queried from
SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
with an invalid optimizer version will fail with a syntax error
(INVALID_ARGUMENT) status.
See
https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
for more information on managing the query optimizer.
The optimizer_version statement hint has precedence over this setting.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version available for \u003ccode\u003eExecuteSqlRequest.Types.QueryOptions\u003c/code\u003e is \u003ccode\u003e5.0.0-beta05\u003c/code\u003e, while the current version of the page is \u003ccode\u003e3.5.0\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eQueryOptions\u003c/code\u003e class is used for configuring the query optimizer.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eQueryOptions\u003c/code\u003e class inherits from \u003ccode\u003eObject\u003c/code\u003e and implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOptimizerVersion\u003c/code\u003e property within \u003ccode\u003eQueryOptions\u003c/code\u003e allows specifying the query optimizer version, with "latest" being an option to utilize the newest version.\u003c/p\u003e\n"],["\u003cp\u003eThe page lists all available versions from \u003ccode\u003e3.5.0\u003c/code\u003e up to \u003ccode\u003e5.0.0-beta05\u003c/code\u003e of the \u003ccode\u003eQueryOptions\u003c/code\u003e class, with links to their respective documentation.\u003c/p\u003e\n"]]],[],null,[]]