如何禁用或绕过phpmyadmin的SQL_CALC_FOUND_ROWS

时间:2022-10-05 20:25:16

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.

当你通过phpmyadmin处理SELECT时,在幕后,它有时会添加一个LIMIT 0,30,和/或它会将一个SQL_CALC_FOUND_ROWS抛入SELECT中,这样就可以告诉我没有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).

不幸的是,添加SQL_CALC_FOUND_ROWS有时需要比我预期的更多的处理(即比我运行原始的无污染查询更多)。

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

是否有全局配置选项来禁用phpmyadmin对我的查询的修改?

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

我可以在每个查询的基础上使用哪些技巧来阻止phpmyadmin的修改?

1 个解决方案

#1


7  

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

快速检查PHPMyAdmin源代码说没有。

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.

但是,如果您查看文件sql.php,并找到标记为“不是”的其他语句,而是“使用”。将那里的代码替换为//结束其他“只是浏览”,例如$ unlim_num_rows = 1000000;你会阻止它进行计数查询,同时仍然能够浏览。

(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)

(每次更新PMA时都必须重复这个,因为它的安全声誉不是很好,所以你应该定期更新,至少可以这么说)

#1


7  

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

快速检查PHPMyAdmin源代码说没有。

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.

但是,如果您查看文件sql.php,并找到标记为“不是”的其他语句,而是“使用”。将那里的代码替换为//结束其他“只是浏览”,例如$ unlim_num_rows = 1000000;你会阻止它进行计数查询,同时仍然能够浏览。

(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)

(每次更新PMA时都必须重复这个,因为它的安全声誉不是很好,所以你应该定期更新,至少可以这么说)