sql >> Base de Datos >  >> RDS >> Mysql

Rendimiento de inserción PHP PDO Mysql

Encontré este. Rendimiento en PDO/PHP/MySQL :transacción versus ejecución directa . así que prueba este.

$query = $data->prepare("INSERT INTO `tbl_temp` (aid, bid) VALUES (?, ?)");
try {
        $data->beginTransaction();
        for($i=0; $i < 150; $i++) {
            $time = time();
            $query->bindValue(1, $i, PDO::PARAM_INT);
            $query->bindValue(2, $time, PDO::PARAM_STR);
            $query->execute();
        }
        $data->commit();
    } catch(PDOException $e) {
            $data->rollBack();
    }