aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2025-01-30 13:09:04 +0100
committerMario Vavti <mario@mariovavti.com>2025-01-30 13:09:04 +0100
commitdc076a4c003124719c15cd681bf0684710d0b93d (patch)
treeb901cb911874eeea8e469bafe6392300f8a54af2 /Zotlabs
parent03d1f3383ed56ddcdaee844f435a39c4b987cd74 (diff)
downloadvolse-hubzilla-dc076a4c003124719c15cd681bf0684710d0b93d.tar.gz
volse-hubzilla-dc076a4c003124719c15cd681bf0684710d0b93d.tar.bz2
volse-hubzilla-dc076a4c003124719c15cd681bf0684710d0b93d.zip
possible sql performance improvements
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Importdoc.php7
-rw-r--r--Zotlabs/Module/Sse_bs.php10
2 files changed, 10 insertions, 7 deletions
diff --git a/Zotlabs/Daemon/Importdoc.php b/Zotlabs/Daemon/Importdoc.php
index 46f96098f..de571848e 100644
--- a/Zotlabs/Daemon/Importdoc.php
+++ b/Zotlabs/Daemon/Importdoc.php
@@ -11,15 +11,18 @@ class Importdoc {
self::update_docs_dir('doc/*');
+ $sys = get_sys_channel();
+
// remove old files that weren't updated (indicates they were most likely deleted).
- $i = q("select id, uid from item where item_type = 5 and edited < %s - INTERVAL %s",
+ $i = q("select id from item where uid = %d and item_type = 5 and edited < %s - INTERVAL %s",
+ intval($sys['channel_id']),
db_utcnow(),
db_quoteinterval('14 DAY')
);
if ($i) {
foreach ($i as $iv) {
- drop_item($iv['id'], uid: $iv['uid']);
+ drop_item($iv['id'], uid: $sys['channel_id']);
}
}
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index d214ba28f..5292abfaa 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -207,7 +207,7 @@ class Sse_bs extends Controller {
$item_normal
$sql_extra
$sql_extra2
- ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ ORDER BY created DESC, received DESC LIMIT $limit OFFSET $offset",
intval(self::$uid),
dbescdate($_SESSION['sse_loadtime']),
dbesc(self::$ob_hash)
@@ -290,7 +290,7 @@ class Sse_bs extends Controller {
$item_normal
$sql_extra
$sql_extra2
- ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ ORDER BY created DESC, received DESC LIMIT $limit OFFSET $offset",
intval(self::$uid),
dbescdate($_SESSION['sse_loadtime']),
dbesc(self::$ob_hash)
@@ -373,7 +373,7 @@ class Sse_bs extends Controller {
$item_normal
$sql_extra
$sql_extra2
- ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ ORDER BY created DESC, received DESC LIMIT $limit OFFSET $offset",
intval(self::$uid),
dbescdate($_SESSION['sse_loadtime']),
dbesc(self::$ob_hash)
@@ -481,7 +481,7 @@ class Sse_bs extends Controller {
$sql_extra
$sql_extra2
$sql_extra3
- ORDER BY created DESC LIMIT $limit OFFSET $offset",
+ ORDER BY created DESC, received DESC LIMIT $limit OFFSET $offset",
dbescdate($_SESSION['sse_loadtime']),
dbesc(self::$ob_hash),
dbescdate($_SESSION['last_login_date'] ?? $_SESSION['static_loadtime'])
@@ -679,7 +679,7 @@ class Sse_bs extends Controller {
AND author_xchan != '%s'
AND item_unseen = 1
$item_normal
- ORDER BY created DESC",
+ ORDER BY created DESC, received DESC",
dbesc(ACTIVITY_POST),
intval(self::$uid),
dbesc(self::$ob_hash)