Huge mysql table with Zend Framework

Posted by Uffo on Stack Overflow See other posts from Stack Overflow or by Uffo
Published on 2010-05-30T21:06:14Z Indexed on 2010/05/30 21:12 UTC
Read the original article Hit count: 402

Filed under:
|
|
|
|

I have a mysql table with over 4 million of data; well the problem is that SOME queries WORK and SOME DON'T it depends on the search term, if the search term has a big volume of data in the table than I get the following error:

Fatal error: Allowed memory size of 1048576000 bytes exhausted (tried to allocate 75   bytes) in /home/****/public_html/Zend/Db/Statement/Pdo.php  on line 290

I currently have Zend Framework cache for metadata enabled, I have index on all the fields from that table.The site is running on a dedicated server with 2gb of ram.

I've also set memory limit to: ini_set("memory_limit","1000M");

Any other things that I can optimize?

Those are the types of query that I'm currently using:

            $do = $this->select()
              ->where('branche LIKE ?','%'.mysql_escape_string($branche).'%')
              ->order('premium DESC');  

        }


        //For name
        if(empty($branche) && empty($plz))
        {
              $do = $this->select("MATCH(`name`) AGAINST ('{$theString}') AS score")
              ->where('MATCH(`name`) AGAINST( ? IN BOOLEAN MODE)', $theString)
              ->order('premium DESC, score');           
        }

And a few other, but they are pretty much the same.

Best Regards

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql