forked from GNUsocial/gnu-social
Performance fix for FriendFeed sup interface: MySQL query optimizer was doing a table scan on notice; explicit subquery makes it run much more efficiently, only scanning items within the period under consideration. Standard subquery should be PostgreSQL-compatible.
This commit is contained in:
parent
5253a99d7a
commit
f6ebe81538
@ -66,10 +66,12 @@ class SupAction extends Action
|
||||
$divider = common_sql_date(time() - $seconds);
|
||||
|
||||
$notice->query('SELECT profile_id, max(id) AS max_id ' .
|
||||
'FROM notice ' .
|
||||
'FROM ( ' .
|
||||
'SELECT profile_id, id FROM notice ' .
|
||||
((common_config('db','type') == 'pgsql') ?
|
||||
'WHERE extract(epoch from created) > (extract(epoch from now()) - ' . $seconds . ') ' :
|
||||
'WHERE created > "'.$divider.'" ' ) .
|
||||
') AS latest ' .
|
||||
'GROUP BY profile_id');
|
||||
|
||||
$updates = array();
|
||||
|
Loading…
Reference in New Issue
Block a user