Commit 6f0dbc74 authored by hosef's avatar hosef Committed by oadaeh

Issue #2659226 by hosef, oadaeh, Kristen Pol: Improve the performance of the...

Issue #2659226 by hosef, oadaeh, Kristen Pol: Improve the performance of the message flushing cron job
parent c6768eb6
......@@ -1241,12 +1241,11 @@ function privatemsg_sql_autocomplete($search, $names) {
* @see hook_query_privatemsg_deleted_alter()
*/
function privatemsg_sql_deleted($days, $max) {
$query = db_select('pm_message', 'pm');
$query->addField('pm', 'mid');
$query = db_select('pm_index', 'pmi');
$query->addField('pmi', 'mid');
$query->join('pm_index', 'pmi', 'pmi.mid = pm.mid');
return $query
->groupBy('pm.mid')
->groupBy('pmi.mid')
->having('MIN(pmi.deleted) > 0 AND MAX(pmi.deleted) < :old', array(':old' => REQUEST_TIME - $days * 86400))
->range(0, $max);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment