代码添加正在减慢页面速度 [英] Code Addition is Slowing Page Down
本文介绍了代码添加正在减慢页面速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的客户订购了另一个脚本,但我不知道如何解决速度变慢的问题?该表大约有 50,000 行.
My client ordered another addition to the script, but I can't figure out how to fix the slowdown? The table has about 50,000 rows.
while($stats = mysql_fetch_array($get_stats)) {
if ($stats['ip'] == gethostbyaddr($stats['ip'])) { // new code
$is_undef = "Yes"; // causing problems
} else { $is_undef = "No"; } // end new code
echo "<tr><td>" . date("d M Y g:i a ", strtotime($stats['date'])) . "</td><td>" .
$stats['ip'] . "</td><td>" .
parse_url_domain($stats['ref_url']) . "</td><td>" .
$is_undef . "</td></tr>";
}
这是查询:
$get_stats = mysql_query("SELECT * FROM visitors WHERE site='$_GET[site]' AND date >= '$start_date' AND date <= '$end_date' ");
推荐答案
我建议在您将每个地址添加到数据库表之前做这个检查(即每次一次而不是 50,000 次每次查看数据!
I would suggest doing this check before you add each address to your database table (ie once each instead of 50,000 times every time the data is viewed!
这篇关于代码添加正在减慢页面速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文