phpMyAdmin "operation could take a long time" messagephpMyAdmin "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:

Share or Bookmark

Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.

Subscribe or Follow

Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.

Comments

blog comments powered by Disqus