MySQL Single Left Join Very SlowMySQL very slow query when changing one WHERE field despite no index/keyHelp...
Class Action - which options I have?
Unreliable Magic - Is it worth it?
Is exact Kanji stroke length important?
How does Loki do this?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
How can a function with a hole (removable discontinuity) equal a function with no hole?
when is out of tune ok?
You cannot touch me, but I can touch you, who am I?
How can I kill an app using Terminal?
Why escape if the_content isnt?
Term for the "extreme-extension" version of a straw man fallacy?
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
Is there a good way to store credentials outside of a password manager?
Fastening aluminum fascia to wooden subfascia
Two monoidal structures and copowering
Is this apparent Class Action settlement a spam message?
What does "I’d sit this one out, Cap," imply or mean in the context?
How does it work when somebody invests in my business?
Large drywall patch supports
What happens if you roll doubles 3 times then land on "Go to jail?"
How do I go from 300 unfinished/half written blog posts, to published posts?
Is `x >> pure y` equivalent to `liftM (const y) x`
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
MySQL Single Left Join Very Slow
MySQL very slow query when changing one WHERE field despite no index/keyHelp optimizing MySQL slow queryOptimizing multi-table left joinsBaffled with MySQL LEFT JOIN query that I have to speed it upWhy does IN (subquery) perform bad when = (subquery) is blazing fast?Deciding which MySQL execution plan is betterVery Simple MySQL Inner Join Extremely SlowSlow SELECT examining whole tableselect MAX() from MySQL view (2x INNER JOIN) is slowMySQL not using primary key on inner join
SELECT
DISTINCT contacts.id FROM contacts FORCE INDEX (PRIMARY)
LEFT JOIN
emails_stats ON contacts.id = emails_stats.contact_id
WHERE
contacts.client_code = 121212121212
GROUP BY
contacts.id;
Table contacts:
Rows: ~74k; Indexes: primary and client_code
Table emails_stats
Rows: ~20k; Indexes: primary and contact_id
The query explain:
1 SIMPLE contacts index PRIMARY,client_code PRIMARY 108 NULL 73258 Using where
1 SIMPLE emails_stats index NULL contact_id 36 NULL 19382 Using where; Using index
mysql
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
SELECT
DISTINCT contacts.id FROM contacts FORCE INDEX (PRIMARY)
LEFT JOIN
emails_stats ON contacts.id = emails_stats.contact_id
WHERE
contacts.client_code = 121212121212
GROUP BY
contacts.id;
Table contacts:
Rows: ~74k; Indexes: primary and client_code
Table emails_stats
Rows: ~20k; Indexes: primary and contact_id
The query explain:
1 SIMPLE contacts index PRIMARY,client_code PRIMARY 108 NULL 73258 Using where
1 SIMPLE emails_stats index NULL contact_id 36 NULL 19382 Using where; Using index
mysql
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
SELECT
DISTINCT contacts.id FROM contacts FORCE INDEX (PRIMARY)
LEFT JOIN
emails_stats ON contacts.id = emails_stats.contact_id
WHERE
contacts.client_code = 121212121212
GROUP BY
contacts.id;
Table contacts:
Rows: ~74k; Indexes: primary and client_code
Table emails_stats
Rows: ~20k; Indexes: primary and contact_id
The query explain:
1 SIMPLE contacts index PRIMARY,client_code PRIMARY 108 NULL 73258 Using where
1 SIMPLE emails_stats index NULL contact_id 36 NULL 19382 Using where; Using index
mysql
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
SELECT
DISTINCT contacts.id FROM contacts FORCE INDEX (PRIMARY)
LEFT JOIN
emails_stats ON contacts.id = emails_stats.contact_id
WHERE
contacts.client_code = 121212121212
GROUP BY
contacts.id;
Table contacts:
Rows: ~74k; Indexes: primary and client_code
Table emails_stats
Rows: ~20k; Indexes: primary and contact_id
The query explain:
1 SIMPLE contacts index PRIMARY,client_code PRIMARY 108 NULL 73258 Using where
1 SIMPLE emails_stats index NULL contact_id 36 NULL 19382 Using where; Using index
mysql
mysql
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 3 mins ago
Kafer76Kafer76
1
1
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Kafer76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Kafer76 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233308%2fmysql-single-left-join-very-slow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Kafer76 is a new contributor. Be nice, and check out our Code of Conduct.
Kafer76 is a new contributor. Be nice, and check out our Code of Conduct.
Kafer76 is a new contributor. Be nice, and check out our Code of Conduct.
Kafer76 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233308%2fmysql-single-left-join-very-slow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown