Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable or circumvent phpmyadmin's SQL_CALC_FOUND_ROWS

When you process a SELECT through phpmyadmin, behind the scenes, it will sometimes add a LIMIT 0,30, and/or it'll throw a SQL_CALC_FOUND_ROWS into the SELECT so it can tell me how many results there would have been without the LIMIT.

Unfortunately, adding the SQL_CALC_FOUND_ROWS sometimes requires much more processing than I was expecting (i.e. more than if I had ran my original untainted query).

Is there a global config option to disable phpmyadmin's modification(s) of my queries?

What tricks can I use on a per-query basis to prevent phpmyadmin's modification(s)?

like image 636
Riedsio Avatar asked Dec 08 '10 23:12

Riedsio


1 Answers

A quick check of the PHPMyAdmin source code says there isn't one.

However, if you look in the file sql.php, and find the else statement labelled // n o t " j u s t b r o w s i n g ". Replace the code between there and // end else "just browsing" with something like $unlim_num_rows = 1000000; you'll prevent it doing its counting query, while still being able to browse.

(you'll have to repeat this each time you update PMA, which you should be doing regularly since its security reputation is not great, to say the least)

like image 102
grahamparks Avatar answered Oct 04 '22 20:10

grahamparks