magento-2-smtp icon indicating copy to clipboard operation
magento-2-smtp copied to clipboard

SMTP Log with a large mageplaza_smtp_log table fails to load

Open abdulmueid opened this issue 2 years ago • 1 comments

SMTP Log page fails to load on a busy Magento site with many emails.

Preconditions (*)

  1. Magento 2.4.3-p2
  2. mageplaza_smtp_log table with many rows and long emails.

Steps to reproduce (*)

  1. Opening the Email log in Magento Admin

Expected result (*)

  1. Page opens and lists all emails correctly

Actual result (*)

  1. Page fails to load.
  2. 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: Screenshot from 2022-05-16 20-48-19

Query Plan after indexing created_at: Screenshot from 2022-05-16 21-05-49

abdulmueid avatar May 16 '22 19:05 abdulmueid

I can confirm this issue.

Also we have about 200 entries in the log.

Thank you.

WebHostingAce avatar May 18 '22 06:05 WebHostingAce