aboutsummaryrefslogtreecommitdiffstats
path: root/mod/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-10 18:55:56 -0700
committerfriendica <info@friendica.com>2015-03-10 18:55:56 -0700
commit9d1df58759b4eff9439c12d081ba5e1264f900a3 (patch)
treefc5887cadac67eed6b52abb4d04787a4622b5bdf /mod/network.php
parentb0a78e528867b6db8d2c0b690424c4096fb33377 (diff)
downloadvolse-hubzilla-9d1df58759b4eff9439c12d081ba5e1264f900a3.tar.gz
volse-hubzilla-9d1df58759b4eff9439c12d081ba5e1264f900a3.tar.bz2
volse-hubzilla-9d1df58759b4eff9439c12d081ba5e1264f900a3.zip
sql optimisation for affinity searches. A new index was added which wasn't added retro-actively to existing DBs as an update. It isn't clear if this helps sites any more than just restricting the abook table to certain channel_id's is (and this field is already indexed).
Diffstat (limited to 'mod/network.php')
-rw-r--r--mod/network.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/mod/network.php b/mod/network.php
index 161b06804..d24d665d8 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -342,9 +342,11 @@ function network_content(&$a, $update = 0, $load = false) {
$sys = get_sys_channel();
$uids = " and item.uid = " . intval($sys['channel_id']) . " ";
$a->data['firehose'] = intval($sys['channel_id']);
+ $abook_uids = "";
}
else {
$uids = " and item.uid = " . local_channel() . " ";
+ $abook_uids = " and abook.abook_channel = " . local_channel() . " ";
}
if(get_pconfig(local_channel(),'system','network_list_mode'))
@@ -376,7 +378,7 @@ function network_content(&$a, $update = 0, $load = false) {
$items = q("SELECT item.*, item.id AS item_id, received FROM item
left join abook on item.author_xchan = abook.abook_xchan
- WHERE true $uids AND item_restrict = 0
+ WHERE true $uids $abook_uids AND item_restrict = 0
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$simple_update
$sql_extra $sql_nets
@@ -407,7 +409,7 @@ function network_content(&$a, $update = 0, $load = false) {
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
left join abook on item.author_xchan = abook.abook_xchan
- WHERE true $uids AND item.item_restrict = 0
+ WHERE true $uids $abook_uids AND item.item_restrict = 0
AND item.parent = item.id
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
@@ -421,7 +423,7 @@ function network_content(&$a, $update = 0, $load = false) {
// update
$r = q("SELECT item.parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
- WHERE true $uids AND item.item_restrict = 0 $simple_update
+ WHERE true $uids $abook_uids AND item.item_restrict = 0 $simple_update
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets ",
intval(ABOOK_FLAG_BLOCKED)