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 consumption units (CUs) are separately calculated for each GetRow operation.
If you call the BacthGetRow 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
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 methods in the response is the same as the order of the TableInBatchGetRowRequest methods in BatchGetRowRequest. The order of the RowInBatchGetRowResponse methods in TableInBatchGetRowResponse is the same as the order of the RowInBatchGetRowRequest methods 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 method still appears in the TableInBatchGetRowResponse method, but 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 in a batch
- Tablestore SDK for Go: Read multiple rows of data in a batch
- Tablestore SDK for Python: Read multiple rows of data in a batch
- Tablestore SDK for Node.js: Read multiple rows of data in a batch
- Tablestore SDK for .NET: Read multiple rows of data in a batch
- Tablestore SDK for PHP: Read multiple rows of data in a batch
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 scenarios, each RowInBatchGetRowRequest method is considered a GetRow operation for which the write CUs are separately calculated. For more information, see GetRow.