Which is fastest in PHP- MySQL or MySQLi?

The MySQL extension is very slightly faster than MySQLi in most benchmarks I've seen reported. The difference is so slight, however, that this should probably not be your criterion for deciding between the two Other factors dwarf the difference in performance between mysql and mysqli. Using mod_php or FastCGI, a bytecode cache like APC, or using data caching judiciously to reduce database hits, are far more beneficial for overall performance of PHP scripts than the choice of MySQL extension Don't be penny wise and pound foolish!

:-).

The MySQL extension is very slightly faster than MySQLi in most benchmarks I've seen reported. The difference is so slight, however, that this should probably not be your criterion for deciding between the two. Other factors dwarf the difference in performance between mysql and mysqli.

Using mod_php or FastCGI, a bytecode cache like APC, or using data caching judiciously to reduce database hits, are far more beneficial for overall performance of PHP scripts than the choice of MySQL extension. Don't be penny wise and pound foolish! :-).

6 +1 just for the last line. Amma stealing that one! – MatW Apr 12 '10 at 17:26 What is the biggest difference between using mysql and mysqli then?

I was taught to only use mysqli and I was never told why. Could you give me a brief explanation? Thanks – Drewdin Sep 22 '10 at 14:18 ext/mysqli supports more features of the underlying MySQL API, such as transactions and prepared queries with parameters.

Also you can call mysqli functions in an object-oriented manner. – Bill Karwin Sep 22 '10 at 14:44.

It depends. " For example, PHP MySQL vs MySQLi Database Access Metrics and the subsequent comments point out arguments both ways. If you have a mature database and codebase, do some testing and see what works in your system.

If not, stop worrying about premature optimization.

The PHP documentation has a good comparison of mysql, mysqli, and PDO. I know you only asked about speed, but others might find this useful. It talks about the feature differences between the options.

Unless milliseconds matter then don't worry. Surely if you have no need for the extra functionality provided by mysqli then just stick with the tried and tested mysql.

Maybe, this can be a reason to make the right choice :: The Plot to Kill PHP MySQL Extension " Yes, you read it right. Recently, Phillip Olson sent to the PHP internals mailing list a proposal to kill the original PHP MySQL extension in future PHP versions.

google.com/search?q=mysqli+benchmark - first result looks to be what you're looking for, as do others on the first page.

3 As the first result in google now seems to be ;, I don't think that was quite what you meant. Perhaps in the future, you'd refrain from sardonic responses. Especially if this very page rises from being the sixth result under your google search.

– Joseph Holsten May 23 '09 at 9:55 2 The point stands - the poster could have Googled and clicked the first result at the time and gotten the answer. That you now need to drop down to the second search result isn't particularly relevant. – ceejayoz May 23 '09 at 13:05.

According to all the Google results for benchmarks linked by ceejayoz it looks like MySQL is at least slightly faster than MySQLi in all the benchmark tests. I do recommend reading the results for details but just figured I'd post something that directly answered the question and bumps up ceejayoz's answer.

The MySQL extension is very slightly faster than MySQLi in most benchmarks I've seen reported. The difference is so slight, however, that this should probably not be your criterion for deciding between the two.

In relation to PHP programming language, MySQL is the old database driver, and MySQLi is the Improved driver. MySQLi takes advantage of the newer features of MySQL 5.

Stackoverflow.com/questions/.../which-is-fastest-in-php-mysql-or-mysqli‎CachedSimilarOct0 › My Sites‎CachedSimilarFeb 3, 2010 – Currently the code uses PHP's mysql extension. I've read in several places that mysqli is better, faster, more attractive, gets more girls, etc, but ...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions