diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-06-03 17:31:50 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-06-03 17:31:50 +0200 |
commit | 3d3e7bafd5821a200d2e2cc54463d6f16f5c5f15 (patch) | |
tree | 726fb8e64621178734000e24b641312bdd080bae | |
parent | a42ff1e6d40496cc93481312b47548200e8af380 (diff) | |
download | volse-hubzilla-3d3e7bafd5821a200d2e2cc54463d6f16f5c5f15.tar.gz volse-hubzilla-3d3e7bafd5821a200d2e2cc54463d6f16f5c5f15.tar.bz2 volse-hubzilla-3d3e7bafd5821a200d2e2cc54463d6f16f5c5f15.zip |
distinct is needed or it can heavily impact pagination in certain situations (5 per page instead of 20). Add ordering to the select clause to mitigate errors in postgres and add item_thread_top = 1 for slightly better performance.
-rw-r--r-- | Zotlabs/Module/Channel.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 6969b6226..80e81580a 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -282,13 +282,13 @@ class Channel extends \Zotlabs\Web\Controller { } } else { - $r = q("SELECT item.parent AS item_id FROM item + $r = q("SELECT DISTINCT item.parent AS item_id, $ordering FROM item left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) WHERE true and item.uid = %d $item_normal AND (abook.abook_blocked = 0 or abook.abook_flags is null) - AND item.item_wall = 1 + AND item.item_wall = 1 AND item.item_thread_top = 1 $sql_extra $sql_extra2 - ORDER BY $ordering DESC, id $pager_sql ", + ORDER BY $ordering DESC $pager_sql ", intval(\App::$profile['profile_uid']) ); } |