Skip to content
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

Newsletter\Model\Subscriber::loadByEmail() does not use MySQL index #12787

Closed
schmengler opened this issue Dec 18, 2017 · 4 comments
Closed

Newsletter\Model\Subscriber::loadByEmail() does not use MySQL index #12787

schmengler opened this issue Dec 18, 2017 · 4 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@schmengler
Copy link
Contributor

Preconditions

  1. Any Magento version between 1.0 and 2.2

Steps to reproduce

  1. Call $subscriber->loadByEmail($email) with debugger or profiler
  2. Inspect SQL query
  3. Inspect execution plan EXPLAIN SELECT * FROM newsletter_subscriber WHERE subscriber_email='...'

Expected result

  1. An index should be use to retrieve the subscriber instantly

Actual result

  1. No index is used, resulting in a slow "Using where" query like this:
+----+-------------+-----------------------+------+---------------+------+---------+------+-------+-------------+
| id | select_type | table                 | type | possible_keys | key  | key_len | ref  | rows  | Extra       |
+----+-------------+-----------------------+------+---------------+------+---------+------+-------+-------------+
|  1 | SIMPLE      | newsletter_subscriber | ALL  | NULL          | NULL | NULL    | NULL | 75735 | Using where |
+----+-------------+-----------------------+------+---------------+------+---------+------+-------+-------------+
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Dec 18, 2017
@devamitbera
Copy link

#mm18in

@magento-engcom-team
Copy link
Contributor

@devamitbera thank you for joining. Please accept team invitation here and self-assign the issue.

@ishakhsuvarov
Copy link
Contributor

Hi @schmengler. Thank you for your report.
The issue has been fixed in #13033 by @devamitbera in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@ishakhsuvarov ishakhsuvarov added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Jan 16, 2018
@magento-engcom-team
Copy link
Contributor

Hi @schmengler. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1351 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

5 participants