Mailing List Archive

[DBMail 0001085]: Slow Query
The following issue has been SUBMITTED.
======================================================================
http://dbmail.org/mantis/view.php?id=1085
======================================================================
Reported By: bajizs
Assigned To:
======================================================================
Project: DBMail
Issue ID: 1085
Category: Database layer
Reproducibility: have not tried
Severity: minor
Priority: normal
Status: new
target:
======================================================================
Date Submitted: 08-Mar-17 21:57 CET
Last Modified: 08-Mar-17 21:57 CET
======================================================================
Summary: Slow Query
Description:
Always see queries in slow log:

SELECT m.message_idnr, n.headername, v.headervalue, CASE WHEN
n.headername='date' THEN 0 WHEN n.headername='subject' THEN 1 WHEN
n.headername='from' THEN 2 WHEN n.headername='content-type' THEN 3 WHEN
n.headername='to' THEN 4 WHEN n.headername='cc' THEN 5 WHEN
n.headername='message-id' THEN 6 END AS seq FROM dbmail_header h LEFT JOIN
dbmail_messages m ON h.physmessage_id=m.physmessage_id LEFT JOIN
dbmail_headername n ON h.headername_id=n.id LEFT JOIN dbmail_headervalue v
ON h.headervalue_id=v.id WHERE m.mailbox_idnr = 17601 AND m.message_idnr
BETWEEN 20939051 AND 28514826 AND n.headername IN
('date','subject','from','content-type','to','cc','message-id') ORDER BY
message_idnr, seq;

Can be optimize this query? Why use column in order by which was produced
from CASE, this will never indexed...
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
08-Mar-17 21:57 bajizs New Issue
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://lists.nfg.nl/mailman/listinfo/dbmail-dev