magento-2-smtp
magento-2-smtp copied to clipboard
SMTP Log with a large mageplaza_smtp_log table fails to load
SMTP Log page fails to load on a busy Magento site with many emails.
Preconditions (*)
- Magento 2.4.3-p2
-
mageplaza_smtp_log
table with many rows and long emails.
Steps to reproduce (*)
- Opening the Email log in Magento Admin
Expected result (*)
- Page opens and lists all emails correctly
Actual result (*)
- Page fails to load.
- Database log shows the following error:
[ERROR] [MY-013131] [Server] Out of sort memory, consider increasing server sort buffer size!
Root Cause
Queries on the SMTP Log page use ORDER BY created_at
. The column created_at is not indexed, therefore the whole table gets loaded in sort memory and before sorting. On a heavy table, this causes sort_buffer_size to exhaust and query fails.
Query Plan before indexing created_at
:
Query Plan after indexing created_at
:
I can confirm this issue.
Also we have about 200 entries in the log.
Thank you.