Quote:
Originally Posted by Oblivion Knight
No, PHP loading is MUCH better (and friendlier) than SQL.. 
|
Which one would be faster, then?
PHP Code:
$result = $DB_site->query("SELECT pagetext FROM post");
$count = 0;
while ($post = $DB_site->fetch_array($result))
{
$count += strlen($post['pagetext']);
}
or
PHP Code:
$result = $DB_site->query_first("SELECT SUM(LENGTH(pagetext)) AS charcount FROM post");
$count = $result['charcount'];
The first makes MySQL do practically nothing but takes a huge amount of time (relative) in PHP to count up all the characters. The second makes MySQL work very hard, but PHP doesn't have to do much at all.
MySQL is not faster than PHP nor vice versa. It depends on how you code the solution.