Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:50:54+00:00 2026-05-15T01:50:54+00:00

I have a mysql table with over 4 million of data; well the problem

  • 0

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

//LE

ZEND_PAGINATOR CODE

        $d = $firmen->doSearch($finalType,$theKeyword,$thePLZ,$theBranche,false,false,false,$theOrder);
    if ($d !== false) {
        $paginator = Zend_Paginator::factory($d);
        $paginator->setItemCountPerPage(5)
                  ->setPageRange(10)
                  ->setCurrentPageNumber($pag);

        $this->view->data = $paginator;

//MYSQL EXPLAIN RESULTS

mysql> EXPLAIN select * from `wirtscha_ksw`.`firmen` WHERE `name` LIKE '%gmbh%';ERROR  2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    32911
Current database: *** NONE ***

 +----+-------------+--------+------+---------------+------+---------+------+---------+-------------+
 | id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows    |   Extra       |
 +----+-------------+--------+------+---------------+------+---------+------+---------+-------------+
 |  1 | SIMPLE      | firmen | ALL  | NULL          | NULL | NULL    | NULL | 3749155 |   Using where | 
 +----+-------------+--------+------+---------------+------+---------+------+---------+-   ------------+
 1 row in set (0.03 sec
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:50:54+00:00Added an answer on May 15, 2026 at 1:50 am

    Do you really need to load all records at once? I’d recommend you to use LIMIT in those queries. In case you need to present the data, also consider using Zend_Paginator.

    UPDATE: The approach you’re taking is to pass Zend_Paginator all the results, which is overkilling with large resultsets. A more optimal approach in those cases is to pass it just the query, and it will then take care of fetching only the data that’s needed to display the page (this includes counting the number of records and limiting the query to the number of results per page), e.g.:

    $paginator = new Zend_Paginator(
        // $query is an instance of Zend_Db_Select
        new Zend_Paginator_Adapter_DbSelect($query);
    );
    $paginator->setItemCountPerPage(5)
              ->setPageRange(10)
              ->setCurrentPageNumber($pag);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql table with over 30 million records that was originally being
I have a MySql database with just over 30 Million rows, but some of
I have a MySQL table with over 6 million records, each with a epoch
I have a MySQL table with about 2 million rows, and a script that
I have mysql table that has a column that stores xml as a string.
I have a mysql table that relies on the unix epoch time stamp equivalent
I have a MySQL table that will only have one row. What should my
I have a MySQL table that contains the columns id , created_date , and
I have a MYSQL table being produced and populated by another program that I
I have a table (in MySQL) called unused with about 5.4 million rows. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.