aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-23 19:56:10 -0700
committerfriendica <info@friendica.com>2015-03-23 19:56:10 -0700
commitc2acab21d44bfaa8e051a42a13b72c056c95b0a3 (patch)
tree9bed606355434db496ecca9aaca04fcac4993381 /include/items.php
parentd32f63df82de01f66d5babe932f20aed9a5b3ee2 (diff)
downloadvolse-hubzilla-c2acab21d44bfaa8e051a42a13b72c056c95b0a3.tar.gz
volse-hubzilla-c2acab21d44bfaa8e051a42a13b72c056c95b0a3.tar.bz2
volse-hubzilla-c2acab21d44bfaa8e051a42a13b72c056c95b0a3.zip
improve performance of the zotfeed queries
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/include/items.php b/include/items.php
index 8e293d761..32e5dcbe5 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4366,12 +4366,11 @@ function zot_feed($uid,$observer_xchan,$arr) {
$sql_extra = item_permissions_sql($uid);
}
+ $limit = " LIMIT 100 ";
+
if($mindate != NULL_DATE) {
$sql_extra .= " and ( created > '$mindate' or edited > '$mindate' ) ";
- $limit = "";
}
- else
- $limit = " limit 0, 50 ";
if($message_id) {
$sql_extra .= " and mid = '" . dbesc($message_id) . "' ";
@@ -4382,20 +4381,20 @@ function zot_feed($uid,$observer_xchan,$arr) {
if(is_sys_channel($uid)) {
require_once('include/security.php');
- $r = q("SELECT distinct parent, created from item
+ $r = q("SELECT parent from item
WHERE uid != %d
- and uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0
- AND (item_flags & %d)>0
- and item_private = 0 $sql_extra ORDER BY created ASC $limit",
+ AND item_private = 0 AND item_restrict = 0 AND uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ")
+ AND (item_flags & %d) > 0
+ $sql_extra GROUP BY parent ORDER BY created ASC $limit",
intval($uid),
intval(ITEM_WALL)
);
}
else {
- $r = q("SELECT distinct parent, created from item
+ $r = q("SELECT parent from item
WHERE uid = %d AND item_restrict = 0
- AND (item_flags & %d)>0
- $sql_extra ORDER BY created ASC $limit",
+ AND (item_flags & %d) > 0
+ $sql_extra GROUP BY parent ORDER BY created ASC $limit",
intval($uid),
intval(ITEM_WALL)
);