Skip to content

Instantly share code, notes, and snippets.

@dotmanila
Last active August 29, 2015 14:27
Show Gist options
  • Save dotmanila/ede81ea108f5dc3990ac to your computer and use it in GitHub Desktop.
Save dotmanila/ede81ea108f5dc3990ac to your computer and use it in GitHub Desktop.
LONGBLOB and mysqlnd seems to be slower.
<?php
//mysql> insert into t (t) values (repeat('a',1048576));
//Query OK, 1 row affected (0.14 sec)
//mysql> show create table t \G
//*************************** 1. row ***************************
// Table: t
//Create Table: CREATE TABLE `t` (
// `t` longtext
//) ENGINE=InnoDB DEFAULT CHARSET=latin1
//1 row in set (0.00 sec)
//https://github.com/jacobbednarz/php-bench/blob/master/benchmark.php
require_once 'benchmark.php';
function t() {
$mysqli = mysqli_init();
if (!$mysqli) {
die('mysqli_init failed');
}
//if (!$mysqli->real_connect('192.168.56.13', 'revin', 'revin', 'dotmanila', 3306, NULL, MYSQLI_CLIENT_COMPRESS)) {
if (!$mysqli->real_connect('192.168.56.13', 'revin', 'revin', 'dotmanila', 3306, NULL)) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
//$r = $mysqli->query("show status like '%compre%'");
//var_dump($r->fetch_array()); die();
$r = $mysqli->query('select * from t');
while($o = $r->fetch_object()) {}
$r->free();
$mysqli->close();
}
$b = new Benchmark();
$b->iterations = 1000;
$b->report('t', 't');
$b->bench();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment