phpMyAdmin "operation could take a long time" message
Posted June 4th, 2008 in PHP
In phpMyAdmin in some of my databases when I am browsing a table and click the button to take me to last page of records I get a Javascript message telling me "This operation could take a long time. Proceed anyway?" with "OK" and "Cancel" buttons. This post looks at why the message pops up and how you can control when it appears.
Why the message appears
After a little searching through the phpMyAdmin code, I found this bit of PHP code which controls whether or not the message appears:
if ($is_innodb && $unlim_num_rows > $GLOBALS['cfg']['MaxExactCount']) {
echo '<input type="hidden" name="find_real_end" value="1" />' . "\n";
// no backquote around this message
$onclick = ' onclick="return confirmAction(\'' . PMA_jsFormat($GLOBALS['strLongOperation'], false) . '\')"';
}
So what the above code is saying, is that if this is an INNODB database table, and $unlim_num_rows is greater than a configuration settings called "MaxExactCount" then show the error message. $unlim_num_rows is the the total number of rows returned by the sql query without any programmatically appended "LIMIT" clause.
Controlling when the message appears
I have found that although it says this operation could take a long time it never seems to. The particular table I'm browsing whenever this message appears only has 30,000 records in it and I always wondered why it didn't appear on the several million record tables I frequently browse on some of my customers' databases. Having searched through the code as shown above it now makes sense: most tables I create a MyISAM and not INNODB and the message only appears for INNODB tables.
If you have an INNODB table and want to control when the "this operation could take a long time" Javascript popup appears, add a 'MaxExactCount' setting to your config.inc.php file like in the following example:
$cfg['MaxExactCount'] = 10000000;
I've set it to 10 million in the above example but you want it to be a smaller value, depending on server load and the time it takes to jump through those records. Trial and error is probably the best way to work out when you do and when you don't want to be notified by the Javascript popup.
Related posts:
- phpMyAdmin "Cannot start session without errors" (Wednesday, October 22nd 2008)
- Set the default font size for phpMyAdmin (Saturday, May 17th 2008)
- phpMyAdmin prevent popup window for query editing (Thursday, April 10th 2008)
- phpMyAdmin (Wednesday, December 10th 2003)
Recent posts:
- List installed packages with YUM (Tuesday, December 2nd 2008)
- Monthly Roundup - November 2008 (Monday, December 1st 2008)
- Weekly Roundup - December 1st 2008 (Monday, December 1st 2008)
- Installing subversion on CentOS (Sunday, November 30th 2008)
- GoDaddy 99 cent .com domain coupon code (Saturday, November 29th 2008)
- Find the index of a string within a string with Javascript (Friday, November 28th 2008)
Subscribe to RSS Feed / Email / Bookmark / Share
Use the buttons below to subscribe to my RSS feed to be notified next time something is posted, share this post with others, or subscribe by email and have my posts sent in a daily email.
