• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Backward Compatability Breaks!

R

ragtek

Guest
#21
All you can do is select more than you need and hope that when you filter them, you have n remaining. Any more than that, you can chop off.

(This is the principle behind pretty much every search engine that has to manage diverse data)
i'm not sure if i misunderstood you, or if your way is also not optimal:p

the current code (with your suggestion) is=> https://github.com/ragtek/xf-addons/blob/master/Latest.php
method getLatestPostsNew

this method is very time consuming on big boards

the limit, which i had in the past, helps here really
PHP:
$nodeModel = XenForo_Model::create('XenForo_Model_Node');
$viewableNodeList = $nodeModel->getViewableNodeList(); // check if this returns pages too, if yes, we need an other way
 
 $nodes = array_keys($viewableNodeList);
 $where = implode(',', $nodes);
 

Mike

XenForo developer
Staff member
#22
i'm not sure if i misunderstood you, or if your way is also not optimal:p

the current code (with your suggestion) is=> https://github.com/ragtek/xf-addons/blob/master/Latest.php
method getLatestPostsNew

this method is very time consuming on big boards

the limit, which i had in the past, helps here really
PHP:
$nodeModel = XenForo_Model::create('XenForo_Model_Node');
$viewableNodeList = $nodeModel->getViewableNodeList(); // check if this returns pages too, if yes, we need an other way

$nodes = array_keys($viewableNodeList);
$where = implode(',', $nodes);
If this is referring what I think it is, it's not that function that's being called. While a larger limit will slow down getLatestPostsNew a small amount, the index is what will make it be fast.

The slow function is getLatestThreads ordered by thread.post_date because there's no index. This forces selecting all rows, sorting, and limiting.
 
R

ragtek

Guest
#23
The slow function is getLatestThreads ordered by thread.post_date because there's no index. This forces selecting all rows, sorting, and limiting.
thx..
hadn't checked the indexes, i thought that both dates have one...