Reads multiple rows of data from one or more tables at the same time.
The BatchGetRow operation is a set of GetRow operations. If you call the BatchGetRow operation, each GetRow operation is separately performed, the response to each GetRow operation is separately returned, and capacity units (CUs) are separately calculated for each GetRow operation.
If you call the BatchGetRow operation instead of calling the GetRow operation multiple times, the response time is reduced, and the data read performance is improved.
Request syntax
message BatchGetRowRequest {
repeated TableInBatchGetRowRequest tables = 1;
}
Parameter | Type | Required | Description |
tables | repeated TableInBatchGetRowRequest | Yes | The rows that you want to read from each table. If one of the following conditions is met, the operation fails and an error is returned:
|
Response syntax
The BatchGetRow operation may partially fail at the row level. However, the operation still returns the HTTP 200 status code. The application must check errors in RowInBatchGetRowResponse to confirm the execution result for each row and then proceed.
message BatchGetRowResponse {
repeated TableInBatchGetRowResponse tables = 1;
}
Parameter | Type | Description |
tables | repeated TableInBatchGetRowResponse | The rows that are read from each table. The order of the TableInBatchGetRowResponse objects in the response is the same as the order of the TableInBatchGetRowRequest objects in BatchGetRowRequest. The order of the RowInBatchGetRowResponse objects in TableInBatchGetRowResponse is the same as the order of the RowInBatchGetRowRequest objects in TableInBatchGetRowRequest. If a row does not exist or if the columns that are specified by using the columns_to_get parameter in a row are empty, the RowInBatchGetRowResponse object still appears in the TableInBatchGetRowResponse object. However, the primary_key_columns and attribute_columns parameters for the row are empty. If a row fails to be read, the value of is_ok in RowInBatchGetRowResponse is false for the row and the row is empty. |
Use Tablestore SDKs
You can use the following Tablestore SDKs to read multiple rows of data from one or more tables at the same time:
Tablestore SDK for Java: Read multiple rows of data at a time
Tablestore SDK for Go: Read multiple rows of data at a time
Tablestore SDK for Python: Read multiple rows of data at a time
Tablestore SDK for Node.js: Read multiple rows of data at a time
Tablestore SDK for .NET: Read multiple rows of data at a time
Tablestore SDK for PHP: Read multiple rows of data at a time
CU consumption
If the operation fails, no CUs are consumed.
If the request times out and the results are undefined, CUs may or may not be consumed.
In other cases, each RowInBatchGetRowRequest object is considered a GetRow operation for which the read CUs are separately calculated. For more information, see CU consumption.