I´m using php and AWS, and i have a table with 3.3m of records, so i need to scan it and i´m using parallels scan.
My question is: the parallels scan use automatically the last evaluated key in the scan after the first time is executed? or i need to set the parameter in the params array.
The code is:
$totalSegments = 10;
$params = array(
'TableName' => $t,
'TotalSegments' => $totalSegments
);
$scanCommands = array();
for($i = 0; $i < $totalSegments; $i++){
$scanCommands[] = $this->db_client->getCommand('Scan', array('Segment' => $i) + $params);
}
$this->db_client->execute($scanCommands);
foreach ($scanCommands as $scanCommand) {
$result = $scanCommand->getResult();
$items = $result["Items"];
}
So i need to know if the last evaluated key is used automatically or i need set in the params array.
Thanks
I doubt this is a parallel scan, but you are paginating the records.
Answer to your question is yes, you need to supply **LastEvaluatedKey** array to
get next set of records
Note: You said you have around 3M records, if table throughput is not high enough you will get throttle errors which needs to be handled separately. If this is something once a while then it is fine else optimize your table and avoid scanning (As recommended by Amazon)