1

Topic: iRedAdmin-Pro: slow page display (domain details, add new user)

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: CentOS Linux 7.4.1708
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hey,
I have a problem with displaying domain details - it takes a lot of time.
When I click on a domain that has about 8,000 users, it takes more than a minute to display the page.
The same happens when you want to add a new user for this domain.

I have browsed the database logs and the query below needs a lot of time.
Is it possible to do it somehow?

                        SELECT domain.domain, domain.description, domain.aliases,
                               domain.mailboxes, domain.maxquota, domain.quota,
                               domain.transport, domain.backupmx, domain.active,
                               domain.settings,
                               sbcc.bcc_address AS sbcc_addr,
                               sbcc.active AS sbcc_active,
                               rbcc.bcc_address AS rbcc_addr,
                               rbcc.active AS rbcc_active,
                               COUNT(DISTINCT mailbox.username) AS mailbox_count,
                               sender_relayhost.relayhost AS relayhost
                          FROM domain
                               LEFT JOIN sender_bcc_domain AS sbcc ON (sbcc.domain=domain.domain)
                               LEFT JOIN recipient_bcc_domain AS rbcc ON (rbcc.domain=domain.domain)
                               LEFT JOIN domain_admins ON (domain.domain = domain_admins.domain)
                               LEFT JOIN mailbox ON (domain.domain = mailbox.domain)
                               LEFT JOIN sender_relayhost ON (sender_relayhost.account = '@' || mailbox.domain)
                         WHERE domain.domain='example.com'
                      GROUP BY domain.domain, domain.description, domain.aliases,
                               domain.mailboxes, domain.maxquota, domain.quota,
                               domain.transport, domain.backupmx, domain.active,
                               domain.settings,
                               sbcc.bcc_address, sbcc.active,
                               rbcc.bcc_address, rbcc.active,
                               sender_relayhost.relayhost
                      ORDER BY domain.domain
                         LIMIT 1

Total query runtime: 01:02 minutes

Regards

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedAdmin-Pro: slow page display (domain details, add new user)

That's too long. I will fix it today. Stay tuned.
Thanks very much for your feedback.

Would you mind i contact you directly via email? Or you can mail us: https://www.iredmail.org/support.html

3

Re: iRedAdmin-Pro: slow page display (domain details, add new user)

UPDATE: This part has been rewritten to use simpler SQL queries in latest development edition, it should be much faster now.

4

Re: iRedAdmin-Pro: slow page display (domain details, add new user)

I've sent you an email. Please send a solution, I will test it in my case.

5

Re: iRedAdmin-Pro: slow page display (domain details, add new user)

Patch sent.