MySQL(i) Benchmarks

Started by Joshua Dickerson, August 29, 2005, 12:14:07 AM

Previous topic - Next topic

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?
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

[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

Quoteremember 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
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.
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

[Unknown]

General test:

# 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');


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]

Advertisement: