Mysql – Zend Framework $table->fetchRow() is very slow

MySQLoptimizationzend-framework

It is taking .6-.8 seconds for this line of my code to execute in my users table model:

$row = $this->fetchRow("username = '$username'");

I'm caching my table metadata for all tables already.

Any idea what could be causing this slowness?

Best Answer

There's a ton of different things that are most likely adding up to the slow execution time (everything from excessive modules in apache / php to file IO issues causing the database to slow down). Have you considered using a tool such as http://www.xdebug.org/ to profile your code? This should let you break it down into different sections and see exactly what is taking the most time.

Zend also provides a performance guide for the framework http://framework.zend.com/manual/en/performance.html