New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Likely inefficient query #189
Comments
Roundcube has good caching and 10k messages are returned in under a second. |
At least this one
did not perform well until I've added index (mailbox_idnr, message_udnr), speeding it up about 100 times Under a load, requests like
starts to perform in 16+ seconds. I'm still investigating. No disk overload, no memory shortage, plenty of idle CPU. Just 40 imapsyncs in parallel on a reasonably fast box |
There are indexes on both mailbox_idnr and mailbox_idnr (with status) so I'm not sure why you need to create a new index, it would be useful to get performance feedback. You can check the tables and indexes that are created here: |
until I've added an index. Sorry, did not keep explain analyze under the same load. but it has speed up to about 10 ms instantly. According to Boguk, it happened because query optimizer had no idea on correlation between message_idnr and mailbox_idnr. |
Perhaps the imapsyncs are causing sequential reads rather than using indexes due to the query plan returning a large volume. Also 40 parallel syncs would put a high load on the connection pool, also disks can be slow with multiple random reads. |
They are fast SSD. Should not be THAT slow and disks are not overloaded. |
Your query is taking a very long time. My database is small (80Gb) but this comparison is what I would have expected: dbmail=# explain (analyze, buffers) SELECT max(message_idnr) FROM dbmail_messages WHERE mailbox_idnr=71;
Result (cost=1.26..1.27 rows=1 width=8) (actual time=0.103..0.105 rows=1 loops=1) |
I have slightly larger base, about a terabyte. |
The dbmail-imap daemon is creating on internal structure per folder that is used in all kind of actions, so it cannot, at this point, to be ommited or avoided. There is an option to alleviate the execution of that query by using ‘mailbox_update_strategy=2’. |
Hello
I'm running a dbmail site with a moderate load, and have some large mailboxes. I've found that some requests (roundcube-originated) are inefficient
returns 20k+ messages which is apparently slow anyway. Can it be an ill-formed IMAP request forcing server to return all messages or is a limit clause omitted by dbmail?
The text was updated successfully, but these errors were encountered: