foreach ($stream->rows(5000) as $batch) $process = $this->transform($batch); $status = $pdo->prepare("INSERT INTO processed_market_data VALUES (?,?)")->executeBatch($process);
While transactions have always been part of PDO, v20 extends this with using native SQL Savepoints.
$pdo->setAttribute(PDO::ATTR_RETRY_DEADLOCK, 3); // Retry up to 3 times $pdo->setAttribute(PDO::ATTR_RETRY_BACKOFF, 'exponential');
One of the main goals of the v2.0 rewrite was raw performance. By shedding legacy baggage, the new iteration achieves: