AnsweredAssumed Answered

Too many records being checked on duplicate query

Question asked by tgirardi on Mar 22, 2016

I'm getting the following warning:


E_WARNING: parse_str() [<a href='function.parse-str'>function.parse-str</a>]: Input variables exceeded 10000. To increase the limit change max_input_vars in php.ini.


This is the stack trace:


/home/datamed/public_html/emedica/sugar/modules/Contacts/ShowDuplicates.php(20)in require_once called at /home/datamed/public_html/emedica/sugar/include/MVC/View/SugarView.php(727)in SugarView::includeClassicFile called at /home/datamed/public_html/emedica/sugar/include/MVC/View/views/view.classic.php(49)in ViewClassic::display called at /home/datamed/public_html/emedica/sugar/include/MVC/View/SugarView.php(118)in SugarView::process called at /home/datamed/public_html/emedica/sugar/include/MVC/Controller/SugarController.php(324)in SugarController::processView called at /home/datamed/public_html/emedica/sugar/include/MVC/Controller/SugarController.php(271)in SugarController::execute called at /home/datamed/public_html/emedica/sugar/include/MVC/SugarApplication.php(67)in SugarApplication::execute called at /home/datamed/public_html/emedica/sugar/index.php(24)


At the same time, this request is doing a query on the database with almost 10.000 rows being search using PRIMARY KEY:


select id, first_name, last_name, title FROM contacts WHERE deleted=? AND (id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=?  OR id=? OR id=?  OR id=?  OR id=? ... many many many more "OR id=?"'s ... OR id=? )


That query takes more than 10 seconds.


How can I avoid such massive duplicate searches?