MySQL optimization-keyword join between tables on and where (01)

Source: Internet
Author: User
1. Join keyword is to link multiple tables together

Both on and where are conditions, but the objects are different

1.1. The keyword on refers to how to connect two tables, such as: on a.name = B.name

is a row-by-row comparison, and then joined together, at which point the contents of the WHERE clause are not judged

1.2. The keyword Where is the final data that is combined for all tables, so that they do not work the same 2. Proper optimization

The keyword Where is the data that iterates through the final Union, and the result is a traversal that matches the condition, so that the lower the number of data rows in the final data, the higher the efficiency (the order of the Where condition field affects the efficiency)

Both on and where are used as conditional constraints to filter the data, so the conditions that can be used in the on statement are not put in the where

MySQL optimization-keyword join between tables on and where (01)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.