aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-06-29 09:22:38 +0000
committerMario <mario@mariovavti.com>2021-06-29 09:22:38 +0000
commitbed81d785c50a1a056a409b8113eceb0c1d47bba (patch)
tree15b63c2aee7c1d2e34309e9f14f8d07542956910 /Zotlabs/Widget
parent0503914527643210af25d9e036238e6ebfee889e (diff)
downloadvolse-hubzilla-bed81d785c50a1a056a409b8113eceb0c1d47bba.tar.gz
volse-hubzilla-bed81d785c50a1a056a409b8113eceb0c1d47bba.tar.bz2
volse-hubzilla-bed81d785c50a1a056a409b8113eceb0c1d47bba.zip
an attempt to improve the query for direct messages on some systems with hopefully no bad side-effect for others
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Messages.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 9679631c6..ed666bfaa 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -42,6 +42,7 @@ class Messages {
$item_normal = item_normal();
$entries = [];
$limit = 30;
+ $dummy_sql = '';
$offset = 0;
if ($options['offset']) {
@@ -53,6 +54,9 @@ class Messages {
switch($options['type']) {
case 'direct':
$type_sql = ' AND item_private = 2 ';
+ // $dummy_order_sql has no other meaning but trick
+ // some mysql backends into using the right index.
+ $dummy_order_sql = ', received DESC ';
break;
case 'starred':
$type_sql = ' AND item_starred = 1 ';
@@ -66,7 +70,7 @@ class Messages {
$type_sql
AND item_thread_top = 1
$item_normal
- ORDER BY created DESC
+ ORDER BY created DESC $dummy_order_sql
LIMIT $limit OFFSET $offset",
intval(local_channel()),
dbescdate($loadtime)