public sealed class PartitionQueryRequest : IMessage<PartitionQueryRequest>, IEquatable<PartitionQueryRequest>, IDeepCloneable<PartitionQueryRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Spanner v1 API class PartitionQueryRequest.
The request for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]
It is not always possible for Cloud Spanner to infer the right SQL type
from a JSON value. For example, values of type BYTES and values
of type STRING both appear in
[params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings.
In these cases, param_types can be used to specify the exact
SQL type for some or all of the SQL query parameters. See the
definition of [Type][google.spanner.v1.Type] for more information
about SQL types.
Parameter names and values that bind to placeholders in the SQL string.
A parameter placeholder consists of the @ character followed by the
parameter name (for example, @firstName). Parameter names can contain
letters, numbers, and underscores.
Parameters can appear anywhere that a literal value is expected. The same
parameter name can be used more than once, for example:
"WHERE id > @msg_id AND id < @msg_id + 100"
It is an error to execute a SQL statement with unbound parameters.
Required. The query request to generate partitions for. The request will
fail if the query is not root partitionable. For a query to be root
partitionable, it needs to satisfy a few conditions. For example, if the
query execution plan contains a distributed union operator, then it must be
the first operator in the plan. For more information about other
conditions, see Read data in
parallel.
The query request must not contain DML commands, such as INSERT, UPDATE, or
DELETE. Use
[ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
PartitionedDml transaction for large, partition-friendly DML operations.
[[["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 \u003ccode\u003ePartitionQueryRequest\u003c/code\u003e class is used to request the partitioning of a query within the Google Cloud Spanner v1 API.\u003c/p\u003e\n"],["\u003cp\u003eThis class 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, ensuring it is part of the wider Google.Protobuf ecosystem and supporting various object operations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePartitionQueryRequest\u003c/code\u003e includes properties for defining the SQL query, \u003ccode\u003eParamTypes\u003c/code\u003e and \u003ccode\u003eParams\u003c/code\u003e for specifying query parameters, \u003ccode\u003ePartitionOptions\u003c/code\u003e for customizing the partitioning, and a required \u003ccode\u003eSession\u003c/code\u003e to use for the creation of partitions.\u003c/p\u003e\n"],["\u003cp\u003eMultiple versions of the \u003ccode\u003ePartitionQueryRequest\u003c/code\u003e are available, with the latest being 5.0.0-beta05, and the documented versions span from 3.5.0 to 5.0.0-beta05.\u003c/p\u003e\n"],["\u003cp\u003eThe SQL query specified within a \u003ccode\u003ePartitionQueryRequest\u003c/code\u003e must be root partitionable and must not include DML commands.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Spanner v1 API - Class PartitionQueryRequest (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/5.0.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.6.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.5.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.4.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.3.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.2.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.1.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.0.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.15.1/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.14.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.13.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.12.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.11.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.10.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.9.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.8.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.7.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.6.0/Google.Cloud.Spanner.V1.PartitionQueryRequest)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.5.0/Google.Cloud.Spanner.V1.PartitionQueryRequest) \n\n public sealed class PartitionQueryRequest : IMessage\u003cPartitionQueryRequest\u003e, IEquatable\u003cPartitionQueryRequest\u003e, IDeepCloneable\u003cPartitionQueryRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Spanner v1 API class PartitionQueryRequest.\n\nThe request for \\[PartitionQuery\\]\\[google.spanner.v1.Spanner.PartitionQuery\\] \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PartitionQueryRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PartitionQueryRequest](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionQueryRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PartitionQueryRequest](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionQueryRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PartitionQueryRequest](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionQueryRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Spanner.V1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.V1.dll\n\nConstructors\n------------\n\n### PartitionQueryRequest()\n\n public PartitionQueryRequest()\n\n### PartitionQueryRequest(PartitionQueryRequest)\n\n public PartitionQueryRequest(PartitionQueryRequest other)\n\nProperties\n----------\n\n### ParamTypes\n\n public MapField\u003cstring, Type\u003e ParamTypes { get; }\n\nIt is not always possible for Cloud Spanner to infer the right SQL type\nfrom a JSON value. For example, values of type `BYTES` and values\nof type `STRING` both appear in\n\\[params\\]\\[google.spanner.v1.PartitionQueryRequest.params\\] as JSON strings.\n\nIn these cases, `param_types` can be used to specify the exact\nSQL type for some or all of the SQL query parameters. See the\ndefinition of \\[Type\\]\\[google.spanner.v1.Type\\] for more information\nabout SQL types.\n\n### Params\n\n public Struct Params { get; set; }\n\nParameter names and values that bind to placeholders in the SQL string.\n\nA parameter placeholder consists of the `@` character followed by the\nparameter name (for example, `@firstName`). Parameter names can contain\nletters, numbers, and underscores.\n\nParameters can appear anywhere that a literal value is expected. The same\nparameter name can be used more than once, for example:\n\n`\"WHERE id \u003e @msg_id AND id \u003c @msg_id + 100\"`\n\nIt is an error to execute a SQL statement with unbound parameters.\n\n### PartitionOptions\n\n public PartitionOptions PartitionOptions { get; set; }\n\nAdditional options that affect how many partitions are created.\n\n### Session\n\n public string Session { get; set; }\n\nRequired. The session used to create the partitions.\n\n### SessionAsSessionName\n\n public SessionName SessionAsSessionName { get; set; }\n\n[SessionName](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionName)-typed view over the [Session](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionQueryRequest#Google_Cloud_Spanner_V1_PartitionQueryRequest_Session) resource name property.\n\n### Sql\n\n public string Sql { get; set; }\n\nRequired. The query request to generate partitions for. The request will\nfail if the query is not root partitionable. For a query to be root\npartitionable, it needs to satisfy a few conditions. For example, if the\nquery execution plan contains a distributed union operator, then it must be\nthe first operator in the plan. For more information about other\nconditions, see [Read data in\nparallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel).\n\nThe query request must not contain DML commands, such as INSERT, UPDATE, or\nDELETE. Use\n\\[ExecuteStreamingSql\\]\\[google.spanner.v1.Spanner.ExecuteStreamingSql\\] with a\nPartitionedDml transaction for large, partition-friendly DML operations.\n\n### Transaction\n\n public TransactionSelector Transaction { get; set; }\n\nRead only snapshot transactions are supported, read/write and single use\ntransactions are not."]]