I FOUND THE SOLUTION!
the problem was from CLEANUP.php
just disable this line
//OPTIMIZE TABLES
//$res = mysql_query("SHOW TABLES");
//while ( $table = mysql_fetch_row($res) )
//{
// Get rid of overhead.
// mysql_query("REPAIR TABLE `$table[0]`;");
// Analyze table for faster indexing.
// mysql_query("ANALYZE TABLE `$table[0]`;");
// Optimize table to minimize thrashing.
// mysql_query("OPTIMIZE TABLE `$table[0]`;");
//
Bump:
Quote:
Originally Posted by Subzero
If you want to remove the join you could change it to a sub query although if it’s faster or not depends on a lot of factors, the main benefit is it filters out a lot of the data removing much of the overhead but you’d have to run benchmarks to determine if it’s faster in this case.
Example:
PHP Code:
SELECT COUNT(*) FROM torrents WHERE category IN (SELECT id FROM categories $where)
This is just off the cuff so might not work straight out the box I’ve not used torrent trader in a few years.
|
need a soliution i have 2.45m torrents and page is loading verry slow
PHP Code:
//Get Total For Pager$res = mysql_query("SELECT COUNT(*) FROM torrents LEFT JOIN categories ON category = categories.id $where LIMIT 35 ") or die(mysql_error());$row = mysql_fetch_array($res);$count = $row[0];//get sql infoif ($count) { list($pagertop, $pagerbottom, $limit) = pager(35, $count, "torrents.php?" . $addparam);$query = "SELECT torrents.id, torrents.category, torrents.sticky, torrents.recommendedx, torrents.viptorrents, torrents.rosubbed, torrents.hardcoded, torrents.italiansub, torrents.dublatro, torrents.dubbed, torrents.multilang, torrents.remux, torrents.HDR, torrents.3d, torrents.flacdst, torrents.adson, torrents.VR, torrents.frenchsub, torrents.russiansub, torrents.engsub, torrents.germansub, torrents.4khdr, torrents.UHD, torrents.fhd, torrents.SD, torrents.KoreanHC, torrents.description, torrents.leechers, torrents.seeders, torrents.name, torrents.size, torrents.torrentlang, torrents.owner, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat AS cat_parent, categories.image AS cat_pic, users.username, users.privacy FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit"; $res = mysql_query($query) or die(mysql_error());}else{ unset($res);}
</div>
need to limit this
$query from total to last 10k