SMF Support > Server Performance and Configuration

MySQL(i) Benchmarks

(1/1)

Joshua Dickerson:
Reading the docs for mysqli on php.net (www.php.net/mysqli) there is a note with a link to http://www.johnjawed.com/benchmarks/ which has some bad benchmarks in my opinion. Anyone done or seen any good comparisons?

[Unknown]:
I saw that.  I haven't had time to really test mysql vs. mysqli.  I'd bet mysql_ is slower than mysqli, especially when you use prepared statements, but we shall see.

-[Unknown]

Joshua Dickerson:

--- Quote ---remember that MySQLi statements are "pre-escaped", meaning that there is no need for you to do mysql_real_escape_string on any of the variables
--- End quote ---
is BS. It is sent via a binary protocol. There is no escaping done, but there is no need for mysql_real_escape_string().

His INSERT benchmark is ridiculous. Why would you use multiple queries for that when you can just use multiple values. Now, for something where I was using different tables, that might be beneficial.

Where are the SELECT queries? SELECT is more important to most than INSERT.

[Unknown]:
General test:


--- Code: ---# description: mysql_query() vs. mysqli_query()
# times: 5000
# name1: mysql_query()
# name2: mysqli_query()

$GLOBALS['mysql'] = mysql_connect('localhost', 'root', '');
$GLOBALS['mysqli'] = mysqli_connect('localhost', 'root', '');

# ---

mysql_query('SET @a = 1', $GLOBALS['mysql']);

# ---

mysqli_query($GLOBALS['mysqli'], 'SET @a = 1');
--- End code ---

About the same speed.  The mysql_ one seems to usually win (maybe just because it's first) by about 1%.  There's at least that much chance of error.

I'm not sure exactly how to test prepared statements without an actual table.  I tried it with SELECTs and 10 dummy integers, and it was definitely slower.

-[Unknown]

[Unknown]:
What does the C function mysql_send_query() aka mysqli_send_query() do?  I can't find docs for it anywhere...?

-[Unknown]

Navigation

[0] Message Index

Go to full version