Author |
|
bayronp.al Newbie
Joined: 13 January 2014
Online Status: Offline Posts: 7
|
Posted: 08 July 2014 at 3:27pm | IP Logged
|
|
|
Good afternoon, it would be possible to optimize the performance of this query?
Regards and thanks in advance
SELECT p.id_folder, p.id_parent, p.type, p.name, p.full_path, p.sync_type, p.hide, p.fld_order, p.flags,
COUNT(messages.id) AS message_count, COUNT(messages_unread.seen) AS unread_message_count,
SUM(messages.size) AS folder_size, MAX(folder_level) AS level
FROM (awm_folders as n, awm_folders_tree as t, awm_folders as p)
LEFT OUTER JOIN awm_messages AS messages ON p.id_folder = messages.id_folder_db
LEFT OUTER JOIN awm_messages AS messages_unread ON
p.id_folder = messages_unread.id_folder_db AND
messages.id = messages_unread.id AND messages_unread.seen = 0
WHERE n.id_parent = -1
AND n.id_folder = t.id_parent
AND t.id_folder = p.id_folder
AND p.id_acct = 8
GROUP BY p.id_folder
ORDER BY p.fld_order;
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 09 July 2014 at 2:04am | IP Logged
|
|
|
I understand this is about queries used in v6 of the product. In current one, folders are no longer stored in the database, which prove to be more efficient compared to optimizing that query. If you wish to optimize it, I suggest to look into this guide:
Optimizing Queries with EXPLAIN
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|