mysqlzend-frameworkzend-db-table

Zend Framework and Mysql - very slow


I am creating a web site using php, mysql and zend framework. When I try to run any sql query, page generation jumps to around 0.5 seconds. That's too high. If i turn of sql, page generation is 0.001. The amount of queries I run, doesn't really affect the page generation time (1-10 queries tested). Stays at 0.5 seconds I can't figure out, what I am doing wrong.

I connect to sql in bootstrap:

protected function _initDatabase ()
{
    try
    {
        $config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV );
        $db = Zend_Db::factory( $config -> database);
        Zend_DB_Table_Abstract::setDefaultAdapter( $db );
    }
    catch ( Zend_Db_Exception $e )
    {

    }
}

Then I have a simple model

class StandardAccessory extends Zend_DB_Table_Abstract
{
    /**
     * The default table name 
     */
    protected $_name = 'standard_accessory';

    protected $_primary = 'model';

    protected $_sequence = false;
}

And finally, inside my index controller, I just run the find method.

require_once APPLICATION_PATH . '/models/StandardAccessory.php';
    $sa = new StandardAccessory( );
    $stndacc = $sa->find( 'abc' );

All this takes ~0.5 seconds, which is way too long. Any suggestions?

Thanks!


Solution

  • Tips: